Mount the uwsgi file instead of copying

This commit is contained in:
Mark Veidemanis 2022-07-29 22:22:22 +01:00
parent aed53dbf8f
commit 026d736bdc
Signed by: m
GPG Key ID: 5ACFCEED46C0904F
4 changed files with 38 additions and 2 deletions

View File

@ -3,13 +3,14 @@ version: "2"
services:
app:
image: pathogen/neptune
build: ./docker
build: ./docker/prod
volumes:
- ${PORTAINER_GIT_DIR}:/code
- ${PORTAINER_GIT_DIR}/docker/prod/uwsgi.ini:/conf/uwsgi.ini
- ${NEPTUNE_LOCAL_SETTINGS}:/code/app/local_settings.py
- ${NEPTUNE_DATABASE_FILE}:/code/db.sqlite3
ports:
- "${NEPTUNE_PORT}:8000"
- "${NEPTUNE_PORT}:8000" # uwsgi socket
env_file:
- ../stack.env

21
docker/prod/Dockerfile Normal file
View File

@ -0,0 +1,21 @@
# syntax=docker/dockerfile:1
FROM python:3
RUN useradd -d /code pathogen
RUN mkdir /code
RUN chown pathogen:pathogen /code
RUN mkdir /conf
RUN chown pathogen:pathogen /conf
RUN mkdir /venv
RUN chown pathogen:pathogen /venv
USER pathogen
ENV PYTHONDONTWRITEBYTECODE=1
ENV PYTHONUNBUFFERED=1
WORKDIR /code
COPY requirements.prod.txt /code/
RUN python -m venv /venv
RUN . /venv/bin/activate && pip install -r requirements.prod.txt
CMD . /venv/bin/activate && uwsgi --ini /conf/uwsgi.ini

View File

@ -6,3 +6,4 @@ opensearch-py
stripe
django-rest-framework
numpy
uwsgi

13
docker/prod/uwsgi.ini Normal file
View File

@ -0,0 +1,13 @@
[uwsgi]
chdir=/code
module=app.wsgi:application
env=DJANGO_SETTINGS_MODULE=app.settings
master=1
pidfile=/tmp/project-master.pid
socket=0.0.0.0:8000
processes=5
harakiri=20
max-requests=5000
vacuum=1
home=/venv