diff --git a/docker-compose.yml b/docker-compose.yml index 28c74f96af1d743cb0e22c5f9b08bbc137944ba8..c0ec6c626f8e095dad6e1fe6de3b3a6ca7685a1a 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -8,13 +8,12 @@ services: dockerfile: ./images/chiefexam environment: - MPLCONFIGDIR=/tmp/ - command: gunicorn --workers 1 --worker-class gevent --bind=0.0.0.0:5000 app:app ports: - "5000:5000" restart: always volumes: - - ./.env:/home/chiefexam/.env:ro - - chiefexam_static_content:/home/chiefexam/app/static + - ./.env:/code/.env:ro + - chiefexam_static_content:/code/app/static links: - postgresql - redis @@ -25,13 +24,13 @@ services: dockerfile: ./images/worker environment: - MPLCONFIGDIR=/tmp/ - command: celery -A app:celery worker --concurrency=4 restart: always volumes: - - ./.env:/home/chiefexam/.env:ro + - ./.env:/code/.env:ro links: - postgresql - redis + privileged: true postgresql: image: postgres:14.1-alpine @@ -57,7 +56,7 @@ services: volumes: - ./images/nginx.conf:/etc/nginx/nginx.conf:ro - ./images/proxy_params:/etc/nginx/proxy_params:ro - - chiefexam_static_content:/home/chiefexam/app/static + - chiefexam_static_content:/code/app/static volumes: chiefexam_static_content: diff --git a/images/chiefexam b/images/chiefexam index 102dcddf83bd27febd9ba1b4b4184d98c9ae686c..50fa3b7eb0e6785f635194cef428d52f1baeb558 100644 --- a/images/chiefexam +++ b/images/chiefexam @@ -1,19 +1,23 @@ -FROM python:3.10 - +FROM ubuntu:20.04 LABEL maintainer="Louis Dümler <louis.duemler@fau.de>" -RUN useradd -r chiefexam +WORKDIR /code +ENV TZ=Europe/Berlin +RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone + +# Install python +RUN apt-get update -y && apt-get install -y \ + python3.8 python3-pip libpq-dev -COPY . ../home/chiefexam +# Copy files into the container +COPY . . -RUN cd /home/chiefexam \ - && pip install -r requirements.txt \ - && touch .env +# Install pip packages +RUN pip install -r requirements.txt -USER chiefexam -ENV USER=chiefexam HOME=/home/chiefexam -WORKDIR /home/chiefexam/ +# Prepare config file +RUN touch .env EXPOSE 5000 -CMD [ "pwd" ] +CMD gunicorn --workers 1 --worker-class gevent --bind=0.0.0.0:5000 app:app diff --git a/images/nginx.conf b/images/nginx.conf index ca35dd7122c2170fcda4f6888facdd202a0ad93f..957ad40393f55705bfa5c85585f5e2577306aecd 100644 --- a/images/nginx.conf +++ b/images/nginx.conf @@ -29,7 +29,7 @@ http { location /static { include proxy_params; - root /home/chiefexam/app; + root /code/app/static; expires 30d; } diff --git a/images/worker b/images/worker index a4544a764121c3b94530c5c45484c59755e7e4d2..6b331387fa786963816b755f30c8f080a87cdf4c 100644 --- a/images/worker +++ b/images/worker @@ -1,12 +1,12 @@ FROM ubuntu:20.04 - LABEL maintainer="Louis Dümler <louis.duemler@fau.de>" +WORKDIR /code ENV TZ=Europe/Berlin RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone # Install python & java -RUN apt update -y && apt install -y \ +RUN apt-get update -y && apt-get install -y \ git libcap-dev \ # curl zip unzip libarchive-tools \ python3.8 python3-pip libpq-dev \ @@ -20,19 +20,13 @@ RUN cd /tmp \ && make isolate \ && make install -RUN useradd -r chiefexam - -COPY . ../home/chiefexam +# Copy files into the container +COPY . . -# Install chiefexam worker -RUN cd /home/chiefexam \ - && pip install -r requirements.txt \ - && touch .env - -USER chiefexam -ENV USER=chiefexam HOME=/home/chiefexam -WORKDIR /home/chiefexam/ +# Install pip packages +RUN pip install -r requirements.txt -EXPOSE 5002 +# Prepare config file +RUN touch .env -CMD [ "pwd" ] +CMD celery -A app:celery worker --concurrency=4 diff --git a/requirements.txt b/requirements.txt index 9e02f2137af76458928e228d6099c0bbb0ba0874..7e7218b6adb46945cb35a6e51c159e3f8466cfd7 100644 --- a/requirements.txt +++ b/requirements.txt @@ -22,30 +22,31 @@ Flask-Login==0.5.0 Flask-Migrate==3.1.0 Flask-Moment==1.0.2 flask-redis==0.4.0 -Flask-Session==0.3.2 -Flask-SocketIO==4.3.1 -Flask-SQLAlchemy==2.4.4 -Flask-WTF==0.14.3 -greenlet==0.4.16 -gunicorn==20.0.4 -importlib-metadata==1.7.0 -itsdangerous==1.1.0 -Jinja2==2.11.2 -kiwisolver==1.2.0 -kombu==4.6.11 -Mako==1.1.3 -MarkupSafe==1.1.1 -matplotlib==3.3.1 -monotonic==1.5 -numpy==1.19.1 -packaging==20.4 -Pillow==7.2.0 -pkg-resources==0.0.0 -psycopg2-binary==2.8.6 -pycparser==2.20 -pyparsing==2.4.7 -python-dateutil==2.8.1 -python-dotenv==0.14.0 +Flask-Session==0.4.0 +Flask-SocketIO==5.1.1 +Flask-SQLAlchemy==2.5.1 +Flask-WTF==1.0.0 +fonttools==4.29.1 +gevent==21.12.0 +gunicorn==20.1.0 +importlib-metadata==4.10.1 +itsdangerous==2.0.1 +Jinja2==3.0.3 +kiwisolver==1.3.2 +kombu==5.2.3 +Mako==1.1.6 +MarkupSafe==2.0.1 +matplotlib==3.5.1 +monotonic==1.6 +numpy==1.22.2 +packaging==21.3 +Pillow==9.0.1 +prompt-toolkit==3.0.27 +psycopg2==2.9.3 +pycparser==2.21 +pyparsing==3.0.7 +python-dateutil==2.8.2 +python-dotenv==0.19.2 python-editor==1.0.4 python-engineio==4.3.1 python-socketio==5.5.1