feat: Add basic docker support
This commit is contained in:
parent
a0f7d0188d
commit
b326534905
11
.dockerignore
Normal file
11
.dockerignore
Normal file
@ -0,0 +1,11 @@
|
||||
# Exclude everything and allow only the necessary files
|
||||
*
|
||||
!/docker/
|
||||
!/src/
|
||||
!/src/manage.py
|
||||
!/pyproject.toml
|
||||
|
||||
# Python
|
||||
*.py[cod]
|
||||
__pycache__
|
||||
|
20
Dockerfile
Normal file
20
Dockerfile
Normal file
@ -0,0 +1,20 @@
|
||||
FROM python:3-slim
|
||||
MAINTAINER Julian-Samuel Gebühr
|
||||
|
||||
ENV DOCKER_BUILD=true
|
||||
|
||||
RUN apt update
|
||||
RUN apt install gettext -y
|
||||
COPY . /app
|
||||
WORKDIR /app
|
||||
RUN mkdir /app/static
|
||||
RUN mkdir /app/media
|
||||
RUN pip install -e . # Without the -e the library static folder will not be copied by collectstatic!
|
||||
|
||||
RUN nf collectstatic --noinput
|
||||
RUN nf compilemessages --ignore venv
|
||||
|
||||
COPY docker/notfellchen.bash /bin/notfellchen
|
||||
|
||||
EXPOSE 8345
|
||||
CMD ["notfellchen"]
|
5
docker/build.cfg
Normal file
5
docker/build.cfg
Normal file
@ -0,0 +1,5 @@
|
||||
[django]
|
||||
secret="NOTREALSECRET"
|
||||
[locations]
|
||||
static=/notfellchen/static
|
||||
media=/notfellchen/media
|
22
docker/notfellchen.bash
Executable file
22
docker/notfellchen.bash
Executable file
@ -0,0 +1,22 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -eux
|
||||
|
||||
cd /app
|
||||
|
||||
AUTOMIGRATE=${AUTOMIGRATE:-yes}
|
||||
NUM_WORKERS_DEFAULT=$((2 * $(nproc --all)))
|
||||
export NUM_WORKERS=${NUM_WORKERS:-$NUM_WORKERS_DEFAULT}
|
||||
|
||||
if [ "$AUTOMIGRATE" != "skip" ]; then
|
||||
nf migrate --noinput
|
||||
fi
|
||||
|
||||
exec gunicorn notfellchen.wsgi \
|
||||
--name notfellchen \
|
||||
--workers $NUM_WORKERS \
|
||||
--max-requests 1200 \
|
||||
--max-requests-jitter 50 \
|
||||
--log-level=info \
|
||||
--bind 0.0.0.0:8345
|
||||
|
Loading…
Reference in New Issue
Block a user