From 22a91750e8cf53f73d983db05b10eab8a03cc36b Mon Sep 17 00:00:00 2001 From: Jochen Saalfeld Date: Thu, 22 Nov 2018 10:46:40 +0100 Subject: [PATCH] fix the docker build --- Dockerfile | 35 +++++++++++++++-------------------- README.rst | 19 ++++++++++++++----- 2 files changed, 29 insertions(+), 25 deletions(-) diff --git a/Dockerfile b/Dockerfile index f9af06564..e67aa2263 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,35 +1,30 @@ FROM python:3.7-slim + +RUN mkdir /app + RUN apt -y update && \ apt -y upgrade && \ - apt install -y libpq-dev supervisor curl wget xz-utils bzip2 git gcc gnupg2 + apt install -y libpq-dev curl wget xz-utils bzip2 git gcc gnupg2 make g++ RUN curl -sL https://deb.nodesource.com/setup_11.x | bash - RUN apt -y install nodejs RUN npm install -g @angular/cli@latest RUN useradd -m openslides - -## BUILD JS STUFF -RUN mkdir /app +RUN chown -R openslides /app WORKDIR /app COPY . /app +RUN rm -rf /app/.virtualenv* && \ + rm -rf /app/client/node_modules RUN chown -R openslides /app + +# Installing python dependencies +RUN pip install -r requirements.txt +RUN rm -rf /var/lib/apt/lists/* + +# installing client USER openslides RUN ng config -g cli.warnings.versionMismatch false && \ cd client && \ npm install RUN cd client && \ - ng build --prod - -# INSTALL PYTHON DEPENDENCIES -USER root -RUN pip install .[big_mode] - -## Clean up -RUN apt-get remove -y python3-pip wget curl -RUN rm -rf /var/lib/apt/lists/* && \ - rm -fr /app/client/node_modules - -RUN mkdir /data && chown openslides /data -USER openslides -EXPOSE 8000 -VOLUME /supervisord.conf -VOLUME /data + ng build --prod && \ + ./node_modules/.bin/compodoc -t -p src/tsconfig.app.json -n 'OpenSlides Documentation' -d ../openslides/static/doc -e html diff --git a/README.rst b/README.rst index 776409bcb..69312c0e0 100644 --- a/README.rst +++ b/README.rst @@ -115,6 +115,20 @@ Download the latest portable version of OpenSlides for Windows from install steps. Simply unzip the downloaded file and run ``openslides.exe``. +Using the Dockerfile +=============================== + +You can either pull the image ``openslides/openslides`` or build it yourself +(via `docker build -t openslides/openslides .`). You have all prequistes installed +it to start a quick server. To see how it should be used to setup an +production environment, see `openslides-docker +`_. + +You can start a quick-setup (not for production purposes, only local testing) with: + + $ docker run -v /path/to/save/something:/app/personal_data -p 4200:4200 openslides/openslides /bin/bash -c "python manage.py createsettings && python manage.py migrate && (python manage.py runserver & (cd client && npm start))" + + Development =========== @@ -123,11 +137,6 @@ If you want to contribute to OpenSlides, have a look at `OpenSlides website `instruction to install the development version `_. -In OpenSlides repository you find a ``Dockerfile`` but this is not for -production use. See our `Multi instance backend for OpenSlides -`_ for more -information. - Installation for big assemblies ===============================