forked from greyli/greybook
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile.multi-stage
More file actions
38 lines (28 loc) · 854 Bytes
/
Dockerfile.multi-stage
File metadata and controls
38 lines (28 loc) · 854 Bytes
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
# stage 1: build
ARG base_image=python:3.12-slim
FROM ${base_image} AS build
WORKDIR /home/greybook
# install dependencies
RUN pip install -U pdm
ENV PDM_CHECK_UPDATE=false
COPY pyproject.toml pdm.lock ./
RUN pdm install --check --prod --no-editable
# stage 2: production
FROM ${base_image}
RUN groupadd -r greybook && useradd -r -g greybook greybook
WORKDIR /home/greybook
# copy the installed dependencies from the previous stage
COPY --from=build /home/greybook/.venv/ .venv/
ENV PATH="/home/greybook/.venv/bin:$PATH"
# copy the application source code from the previous stage
COPY greybook greybook
COPY migrations migrations
COPY uploads uploads
COPY app.py .
RUN chown -R greybook:greybook .
USER greybook
ENV FLASK_APP=app.py
ENV FLASK_CONFIG=production
ENV GREYBOOK_LOGGING_PATH=stream
EXPOSE 5000
ENTRYPOINT ["./docker-entrypoint.sh"]