diff --git a/Dockerfile b/Dockerfile index c653e47..5cc0b12 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,10 +1,34 @@ FROM ubuntu:18.04 +# Environment variables +ENV NODE_VERSION 12.8.0 +ENV NPM_VERSION 3.5.2 +ENV NVM_DIR /usr/local/nvm +ENV NVM_VERSION 0.34.0 +ENV PYTHON_VERSION 3.6.7-1~18.04 +ENV PATH /jepostule/node_modules/.bin/:${PATH} +ENV DJANGO_SETTINGS_MODULE config.settings.local +ENV LANG C.UTF-8 + RUN apt update -y && \ - apt install -y python3 python3-pip postgresql-client-common npm + apt install -y \ + python3=$PYTHON_VERSION \ + python3-pip \ + postgresql-client-common \ + curl \ + npm=$NPM_VERSION-0ubuntu4 RUN ln -s /usr/bin/python3 /usr/local/bin/python RUN ln -s /usr/bin/pip3 /usr/local/bin/pip +# Install NVM +RUN mkdir $NVM_DIR +RUN curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v$NVM_VERSION/install.sh | bash + +# Install NodeJS with NVM +RUN /bin/bash -c "source $NVM_DIR/nvm.sh \ + && nvm install $NODE_VERSION \ + && nvm use $NODE_VERSION" + WORKDIR /jepostule # Install python requirements @@ -12,14 +36,12 @@ COPY ./requirements/ ./requirements/ RUN pip install -r requirements/prod.txt COPY . /jepostule -ENV PATH /jepostule/node_modules/.bin/:${PATH} -ENV DJANGO_SETTINGS_MODULE config.settings.local -ENV LANG C.UTF-8 -EXPOSE 8000 # Install frontend requirements RUN npm install --unsafe-perm +EXPOSE 8000 + RUN mkdir -p /var/log/uwsgi CMD uwsgi --module=config.wsgi:application \ --master \ diff --git a/README.md b/README.md index 1eff79c..fa6b298 100644 --- a/README.md +++ b/README.md @@ -49,6 +49,9 @@ On partner websites, the user can click on "Je Postule" buttons for each display ./manage.py consumetopics all ./manage.py dequeuedelayed +NodeJS version: `12.8.0` (see [`Dockerfile`](/Dockerfile) and [`package.json`](/package.json)). +Python requirements: see the [requirements](/requirements) folder. This project uses Python `3.6`. + ### Install #### System dependencies @@ -139,7 +142,7 @@ Run unit tests with code coverage: The home page should redirect you to the embed demo page (useful to test if your installation worked!). To make it work, you must: -- create a client platform (see section [Create client platform](#create-client-platform)) +- create a client platform (see section [Client platform creation](#client-platform-creation)) - add these parameters to the demo page URL: `client_id` and `client_secret`. Example: `/embed/demo/?client_id=&client_secret=` diff --git a/package.json b/package.json index 43e3019..f4de2d0 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,11 @@ { "name": "jepostule", "version": "0.0.1", + "engineStrict": true, + "engines": { + "node": "12.8.0" + }, + "private": true, "dependencies": { "jquery-datetimepicker": "^2.5.21", "yuglify": "^2.0.0",