-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathDockerfile
More file actions
68 lines (48 loc) · 1.95 KB
/
Copy pathDockerfile
File metadata and controls
68 lines (48 loc) · 1.95 KB
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
# ==============================
FROM helsinki.azurecr.io/ubi9/python-312-gdal AS appbase
# ==============================
# Branch or tag used to pull python-uwsgi-common.
ARG UWSGI_COMMON_REF=main
ENV PYTHONDONTWRITEBYTECODE 1
ENV PYTHONUNBUFFERED 1
WORKDIR /app
USER root
COPY requirements.txt .
RUN dnf update -y && \
dnf install -y nmap-ncat && \
dnf clean all && \
pip install -U pip setuptools wheel && \
pip install --no-cache-dir -r requirements.txt
# Build and copy specific python-uwsgi-common files.
ADD https://github.com/City-of-Helsinki/python-uwsgi-common/archive/${UWSGI_COMMON_REF}.tar.gz /usr/src/
RUN mkdir -p /usr/src/python-uwsgi-common && \
tar --strip-components=1 -xzf /usr/src/${UWSGI_COMMON_REF}.tar.gz -C /usr/src/python-uwsgi-common && \
cp /usr/src/python-uwsgi-common/uwsgi-base.ini /app/ && \
uwsgi --build-plugin /usr/src/python-uwsgi-common && \
rm -rf /usr/src/${UWSGI_COMMON_REF}.tar.gz && \
rm -rf /usr/src/python-uwsgi-common
# Install uWSGI Sentry plugin
RUN mkdir -p /usr/local/lib/uwsgi/plugins && \
uwsgi --build-plugin https://github.com/City-of-Helsinki/uwsgi-sentry && \
mv sentry_plugin.so /usr/local/lib/uwsgi/plugins/
ENTRYPOINT ["/app/docker-entrypoint.sh"]
# ==============================
FROM appbase AS development
# ==============================
COPY requirements-dev.txt .
RUN pip install --no-cache-dir -r requirements-dev.txt
ENV DEV_SERVER=1
COPY . .
# django-munigeo municipality importer requires this
RUN mkdir -p /app/data && chgrp -R 0 /app/data && chmod g+w -R /app/data
USER default
EXPOSE 8000/tcp
# ==============================
FROM appbase AS production
# ==============================
COPY . .
# django-munigeo municipality importer requires this
RUN mkdir -p /app/data && chgrp -R 0 /app/data && chmod g+w -R /app/data
RUN SECRET_KEY="only-used-for-collectstatic" python manage.py collectstatic && python manage.py compilemessages
USER default
EXPOSE 8000/tcp