-
Notifications
You must be signed in to change notification settings - Fork 25
/
Dockerfile
89 lines (68 loc) · 2.01 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
# syntax=docker/dockerfile:1
ARG PYTHON_VERSION=3.11
##################################################
# Python #
##################################################
FROM python:${PYTHON_VERSION}-slim-bookworm AS prod
ENV PYTHONUNBUFFERED 1
ENV DJANGO_SETTINGS_MODULE=signals.settings
ARG DJANGO_SECRET_KEY=insecure_docker_build_key
WORKDIR /app
RUN useradd --no-create-home signals
RUN set -eux; \
apt-get update && apt-get install -y \
libgeos3.11.1 \
gdal-bin \
libgdal32 \
libspatialite7 \
libfreexl1 \
libgeotiff5 \
libwebp7 \
proj-bin \
mime-support \
gettext \
libwebpmux3 \
libwebpdemux2 \
libxml2 \
libfreetype6 \
libtiff6 \
libgdk-pixbuf2.0-0 \
libmagic1 \
libcairo2 \
libpango1.0-0 \
libpq-dev \
gcc \
graphviz \
; \
rm -rf /var/lib/apt/lists/*
COPY app/requirements /app/requirements
RUN set -eux; \
pip install --no-cache -r /app/requirements/requirements.txt; \
pip install --no-cache tox; \
chgrp signals /app; \
chmod g+w /app; \
mkdir -p /app/static /app/media; \
chown signals /app/static; \
chown signals /app/media
COPY app /app
USER signals
RUN SECRET_KEY=$DJANGO_SECRET_KEY python manage.py collectstatic --no-input
CMD uwsgi
##################################################
# DEV #
##################################################
FROM prod AS dev
USER root
RUN set -eux; \
pip install pip-tools; \
pip-sync requirements/requirements.txt requirements/requirements_dev.txt
USER signals
##################################################
# TEST #
##################################################
FROM prod AS test
USER root
RUN set -eux; \
pip install pip-tools; \
pip-sync requirements/requirements.txt requirements/requirements_test.txt
USER signals