-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
87 lines (73 loc) · 2.39 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
# SPDX-FileCopyrightText: 2023 - 2024 GESIS - Leibniz-Institut für Sozialwissenschaften
# SPDX-FileContributor: Raniere Gaia Costa da Silva <[email protected]>
#
# SPDX-License-Identifier: AGPL-3.0-or-later
FROM ubuntu:22.04 AS basic
WORKDIR /var/magdalena
RUN apt-get update \
&& apt-get -y upgrade \
&& apt-get -y install \
libxml2-dev \
libxslt-dev \
python3 \
python3-dev \
python3-pip \
git \
ca-certificates \
curl \
gnupg \
&& install -m 0755 -d /etc/apt/keyrings \
&& { curl -fsSL https://download.docker.com/linux/ubuntu/gpg | gpg --dearmor -o /etc/apt/keyrings/docker.gpg ; } \
&& chmod a+r /etc/apt/keyrings/docker.gpg \
&& { echo "deb [arch="$(dpkg --print-architecture)" signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu "$(. /etc/os-release && echo "$VERSION_CODENAME")" stable" | tee /etc/apt/sources.list.d/docker.list > /dev/null ; } \
&& apt-get -y update \
&& apt-get -y install \
docker-ce \
docker-ce-cli \
containerd.io \
docker-buildx-plugin \
docker-compose-plugin \
&& rm -rf /var/lib/apt/lists/*
COPY pyproject.toml ./
COPY poetry.lock ./
RUN python3 -m pip install poetry \
--no-cache-dir \
--progress-bar off \
--no-input \
--no-color \
&& poetry config virtualenvs.create false \
&& poetry install \
--without dev \
--no-interaction \
--no-ansi \
&& pip cache purge
RUN curl \
-L \
-o /tmp/keycloak-js-24.0.2.tgz \
"https://github.com/keycloak/keycloak/releases/download/24.0.2/keycloak-js-24.0.2.tgz" \
&& mkdir -p /var/keycloak \
&& tar \
-zxvf /tmp/keycloak-js-24.0.2.tgz \
-C /var/keycloak package/dist/keycloak.min.js \
--strip-components 2 \
&& rm /tmp/keycloak-js-24.0.2.tgz
CMD flask run --host 0.0.0.0 --port 5000 --reload --debug --debugger
EXPOSE 5000
FROM basic AS dev
RUN poetry config virtualenvs.create false \
&& poetry install \
--with dev \
--no-interaction \
--no-ansi \
&& pip cache purge
FROM basic AS prod
RUN python3 -m pip install \
gunicorn \
--no-cache-dir \
--progress-bar off \
--no-input \
--no-color
# COPY source directory itself isn't copied, only its contents.
# See .dockerignore for files that are not copied.
COPY . ./
CMD gunicorn --workers=2 --bind 0.0.0.0:5000 'wsgi:app' --log-level ${LOG_LEVEL:=warning}