-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
65 lines (50 loc) · 2.07 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
# =============================================================================
# Build instructions for the Docker container
# =============================================================================
# This file is part of the FSFE Form Server.
#
# SPDX-FileCopyrightText: 2020 FSFE e.V. <[email protected]>
#
# SPDX-License-Identifier: GPL-3.0-or-later
# =============================================================================
# Create requirements.txt file
# =============================================================================
FROM bitnami/python:3.9 as requirements-builder
WORKDIR /root
ENV PATH="$PATH:/root/.local/bin"
# Upgrade / install pipx
RUN python3 -m pip install --user pipx
RUN python3 -m pipx ensurepath
# Install pipenv with pipx
RUN python3 -m pipx install pipenv
# Import Python packages
COPY Pipfile Pipfile.lock ./
# Create requirements.txt for the next step
RUN pipenv requirements > requirements.txt
# =============================================================================
# Install dependencies
# =============================================================================
FROM bitnami/python:3.9 as dependencies
EXPOSE 8080
WORKDIR /root
COPY --from=requirements-builder /root/requirements.txt ./
RUN pip install --ignore-installed setuptools pip
RUN pip install wheel
RUN pip install --no-cache-dir -r requirements.txt
# Install the actual application
COPY . .
RUN ./setup.py install
# =============================================================================
# Development installation
# =============================================================================
FROM dependencies AS development
# Switch to non-root user
RUN adduser --uid 1000 --gecos "FSFE" --shell "/sbin/nologin" --disabled-password fsfe
USER fsfe
WORKDIR /home/fsfe
# =============================================================================
# Production installation
# =============================================================================
FROM development as production
# Run the WSGI server
CMD gunicorn --bind 0.0.0.0:8080 "fsfe_forms:create_app()"