forked from AccentDesign/snippets
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
executable file
·73 lines (63 loc) · 2.09 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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
FROM python:3.6-alpine
# Build args:
ARG REQUIREMENTS_FILE=/build/requirements/base.txt
# Copy in your requirements folder:
ADD requirements /build/requirements/
# Install runtime, build & python dependencies:
RUN set -ex \
&& apk update \
&& apk add --no-cache \
# postgres
libpq \
postgresql-client \
# pillow
jpeg-dev \
zlib-dev \
# misc
make \
&& apk add --no-cache --virtual .build-deps \
gcc \
git \
libc-dev \
linux-headers \
musl-dev \
postgresql-dev \
python3-dev \
&& pip install --no-cache-dir -r $REQUIREMENTS_FILE \
&& apk del .build-deps
# Copy your application code to the container:
RUN mkdir /code/
WORKDIR /code/
ADD . /code/
# Upload perms:
RUN chmod -Rf 777 /code/public/media
# Add any custom, static environment variables needed by Django:
ENV PYTHONUNBUFFERED=1 \
DJANGO_SETTINGS_MODULE=app.settings \
SECRET_KEY='***** change me *****' \
ALLOWED_HOSTS=* \
RDS_HOSTNAME=db \
RDS_PORT=5432 \
RDS_DB_NAME=postgres \
RDS_USERNAME=postgres \
RDS_PASSWORD=password \
EMAIL_HOST=mail \
EMAIL_PORT=1025 \
EMAIL_HOST_USER=user \
EMAIL_HOST_PASSWORD=password
# uWSGI configuration:
ENV UWSGI_WSGI_FILE=app/wsgi.py \
UWSGI_HTTP=:8000 \
UWSGI_MASTER=1 \
UWSGI_WORKERS=2 \
UWSGI_THREADS=8 \
UWSGI_UID=1000 \
UWSGI_GID=2000 \
UWSGI_LAZY_APPS=1 \
UWSGI_WSGI_ENV_BEHAVIOR=holy
# Docker entrypoint:
ENV DJANGO_MANAGEPY_MIGRATE=on \
DJANGO_MANAGEPY_COLLECTSTATIC=on
ENTRYPOINT ["/code/docker-entrypoint.sh"]
# Start uWSGI:
CMD ["uwsgi", "--http-auto-chunked", "--http-keepalive"]