-
-
Notifications
You must be signed in to change notification settings - Fork 13
Expand file tree
/
Copy pathDockerfile
More file actions
executable file
·36 lines (28 loc) · 1.47 KB
/
Dockerfile
File metadata and controls
executable file
·36 lines (28 loc) · 1.47 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
ARG env
# using alpine for smallest docker image from https://hub.docker.com/_/python
FROM python:3.12.2-alpine3.19 AS base
# Install dependencies for package compilation on macOS
RUN apk add --no-cache build-base libffi-dev
WORKDIR /app
# install packages separately to use docker build-caching so we don't need to
# re-fetch these if code has changed but our requirements.txt hasn't
COPY requirements.txt /app
COPY requirements-dev.txt /app
RUN pip install -r requirements.txt -r requirements-dev.txt && rm requirements*.txt
# Install dependencies for Auth0 integration tests (public key extraction)
RUN apk add --no-cache openssl
# Simulate editable install for boxtribute-server package. This is required to resolve imports
# (editable installing is not possible during Docker build since the code directory is only
# mounted at container runtime)
RUN echo "/app/back" > /usr/local/lib/python3.12/site-packages/boxtribute-server.egg-link
ENV PYTHONPATH=/app/back
# Build two stages for the conditions production/development
# cf. https://stackoverflow.com/a/60820156/3865876
FROM base AS production
# Launch WSGI server, configured by gunicorn.conf.py
CMD gunicorn --config back/gunicorn.conf.py boxtribute_server.dev_main:app
FROM base AS development
# Path of module containing Flask app, relative to WORKDIR
CMD flask --debug --app back/boxtribute_server/dev_main.py run -h 0.0.0 -p 5005 --exclude-patterns '*/test/*'
# Select final stage depending on env argument
FROM ${env} AS final