-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathDockerfile
50 lines (40 loc) · 1.61 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
FROM python:3.8-slim-buster
ARG WSGI_USER=gunaha
# Choose an ID that will be consistent across all machines in the network
# To avoid overlap with user IDs, use an ID over
# /etc/login.defs:/UID_MAX/, which defaults to 60,000
ARG UID_GID=60001
RUN groupadd --system --gid ${UID_GID} ${WSGI_USER} \
&& useradd --no-log-init --system --gid ${WSGI_USER} --uid ${UID_GID} ${WSGI_USER}
# Setup Python deps
ADD requirements.txt /app/requirements.txt
# Build dependencies, then remove the deps we needed just for building
RUN set -ex \
&& BUILD_DEPS=" \
build-essential \
" \
&& RUNTIME_DEPS=" \
ffmpeg \
" \
&& apt-get update \
&& apt-get install -y --no-install-recommends $BUILD_DEPS \
&& apt-get install -y --no-install-recommends $RUNTIME_DEPS \
&& pip install --no-cache-dir -r /app/requirements.txt \
&& pip install --no-cache-dir uwsgi \
&& apt-get purge -y --auto-remove -o APT::AutoRemove:RecommendsImportant=false $BUILD_DEPS \
&& rm -rf /var/lib/apt/lists/* \
&& mkdir /data/
# Copy our application. Make sure .dockerignore is setup properly!
WORKDIR /app/
ADD . /app/
# uWSGI will listen on this port:
EXPOSE 8000
# Put the static files in the right place:
# TODO: RUN python manage.py collectstatic --noinput
# Where to find the wsgi file:
ENV UWSGI_WSGI_FILE=gunahasite/wsgi.py
# Essential UWSGI config
ENV UWSGI_HTTP=:8000 UWSGI_MASTER=1 UWSGI_HTTP_KEEPALIVE=1 UWSGI_AUTO_CHUNKED=1 UWSGI_WSGI_ENV_BEHAVIOUR=holy
# uwsgi CANNOT run as root!
USER ${WSGI_USER}:${WSGI_USER}
CMD ["uwsgi", "--show-config"]