-
Notifications
You must be signed in to change notification settings - Fork 9
/
Dockerfile
135 lines (118 loc) · 3.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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
FROM debian:bullseye-slim AS builder
RUN set -eu ; \
export DEBIAN_FRONTEND=noninteractive ; \
apt-get update \
&& apt-get install --no-install-recommends --yes \
build-essential \
ca-certificates \
curl \
dumb-init \
gettext \
gettext-base \
libffi-dev \
libjpeg-dev \
libjpeg62-turbo \
libmagic1 \
libpng-dev \
libpng16-16 \
libpq-dev \
libpq5 \
libxml2 \
libxml2-dev \
libxslt-dev \
libxslt1.1 \
linux-headers-$(dpkg --print-architecture) \
openssl \
python3 \
python3-dev \
python3-pip \
uwsgi \
uwsgi-plugin-python3 \
zlib1g-dev \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
RUN \
addgroup --gid 10000 devday \
&& adduser \
--disabled-password \
--gecos "Application user" \
--home /app \
--ingroup devday \
--no-create-home \
--uid 10000 \
devday
COPY pyproject.toml poetry.lock /python-code/
WORKDIR /python-code/
RUN \
set -eu ; \
export DEBIAN_FRONTEND=noninteractive ; \
export PYTHONBUFFERED=1 ; \
export PYTHONFAULTHANDLER=1 ; \
export PIP_NO_CACHE_DIR=off ; \
export PIP_DISABLE_VERSION_CHECK=on ; \
export PIP_DEFAULT_TIMEOUT=100 \
&& python3 -m pip install -U wheel poetry \
&& poetry config virtualenvs.in-project true \
&& poetry install \
&& rm -rf /root/.cache /root/.local /tmp/*.json \
&& python3 -m pip uninstall --yes poetry
ENV PATH="/python-code/.venv/bin:$PATH"
COPY devday /app/
RUN set -eu ; \
cd /app ; \
echo 'SECRET_KEY="dummy"' > compilemessages_settings.py \
&& DJANGO_SETTINGS_MODULE=compilemessages_settings python3 manage.py compilemessages \
&& rm -rf compilemessages_settings.py __pycache__ /var/lib/apt/lists/*
FROM debian:bullseye-slim
LABEL maintainer="Jan Dittberner <[email protected]>"
LABEL vendor="Deutsche Telekom MMS GmbH"
ENV \
REQUESTS_CA_BUNDLE=/etc/ssl/certs/ca-certificates.crt
RUN set -eu ; \
export DEBIAN_FRONTEND=noninteractive ; \
apt-get update \
&& apt-get install --no-install-recommends --yes \
ca-certificates \
curl \
dumb-init \
gettext-base \
libjpeg62-turbo \
libmagic1 \
libpng16-16 \
libpq5 \
libxml2 \
libxslt1.1 \
openssl \
python3 \
uwsgi \
uwsgi-plugin-python3 \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
RUN \
addgroup --gid 10000 devday \
&& adduser \
--disabled-password \
--gecos "Application user" \
--home /app \
--ingroup devday \
--no-create-home \
--uid 10000 \
devday
WORKDIR /app
EXPOSE 7000
COPY devday /app/
COPY docker/app/start-application.sh docker/app/uwsgi.ini docker/app/devday.wsgi /app/
COPY --from=builder /python-code/.venv /python-code/.venv
COPY --from=builder /app/attendee/locale/de/LC_MESSAGES/django.mo /app/attendee/locale/de/LC_MESSAGES/
COPY --from=builder /app/devday/locale/de/LC_MESSAGES/django.mo /app/devday/locale/de/LC_MESSAGES/
COPY --from=builder /app/event/locale/de/LC_MESSAGES/django.mo /app/event/locale/de/LC_MESSAGES/
COPY --from=builder /app/speaker/locale/de/LC_MESSAGES/django.mo /app/speaker/locale/de/LC_MESSAGES/
COPY --from=builder /app/sponsoring/locale/de/LC_MESSAGES/django.mo /app/sponsoring/locale/de/LC_MESSAGES/
COPY --from=builder /app/talk/locale/de/LC_MESSAGES/django.mo /app/talk/locale/de/LC_MESSAGES/
RUN python3 -m compileall /app
RUN mkdir -p /app/media /app/static /app/logs ; \
chown -R devday.devday /app/media /app/static /app/logs
VOLUME /app/media /app/static /app/logs
USER devday
ENV PATH="/python-code/.venv/bin:$PATH"
ENTRYPOINT ["dumb-init", "/app/start-application.sh"]