fix the docker build

This commit is contained in:
Jochen Saalfeld 2018-11-22 10:46:40 +01:00
parent d8886eb08f
commit 22a91750e8
No known key found for this signature in database
GPG Key ID: 8ACD4E8264B67DF4
2 changed files with 29 additions and 25 deletions

View File

@ -1,35 +1,30 @@
FROM python:3.7-slim FROM python:3.7-slim
RUN mkdir /app
RUN apt -y update && \ RUN apt -y update && \
apt -y upgrade && \ 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 curl -sL https://deb.nodesource.com/setup_11.x | bash -
RUN apt -y install nodejs RUN apt -y install nodejs
RUN npm install -g @angular/cli@latest RUN npm install -g @angular/cli@latest
RUN useradd -m openslides RUN useradd -m openslides
RUN chown -R openslides /app
## BUILD JS STUFF
RUN mkdir /app
WORKDIR /app WORKDIR /app
COPY . /app COPY . /app
RUN rm -rf /app/.virtualenv* && \
rm -rf /app/client/node_modules
RUN chown -R openslides /app 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 USER openslides
RUN ng config -g cli.warnings.versionMismatch false && \ RUN ng config -g cli.warnings.versionMismatch false && \
cd client && \ cd client && \
npm install npm install
RUN cd client && \ RUN cd client && \
ng build --prod ng build --prod && \
./node_modules/.bin/compodoc -t -p src/tsconfig.app.json -n 'OpenSlides Documentation' -d ../openslides/static/doc -e html
# 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

View File

@ -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``. 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
<https://github.com/OpenSlides/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 Development
=========== ===========
@ -123,11 +137,6 @@ If you want to contribute to OpenSlides, have a look at `OpenSlides website
`instruction to install the development version `instruction to install the development version
<https://github.com/OpenSlides/OpenSlides/blob/master/DEVELOPMENT.rst>`_. <https://github.com/OpenSlides/OpenSlides/blob/master/DEVELOPMENT.rst>`_.
In OpenSlides repository you find a ``Dockerfile`` but this is not for
production use. See our `Multi instance backend for OpenSlides
<https://github.com/OpenSlides/openslides-multiinstance-backend>`_ for more
information.
Installation for big assemblies Installation for big assemblies
=============================== ===============================