3
3
ARG PUSH_SENTRY_RELEASE="false"
4
4
5
5
# Build step #1: build the React front end
6
- FROM node:22 -alpine AS build-step
6
+ FROM node:23 -alpine AS build-step
7
7
ARG SENTRY_RELEASE=""
8
8
WORKDIR /app
9
9
ENV PATH=/app/node_modules/.bin:$PATH
@@ -31,17 +31,27 @@ RUN sentry-cli releases finalize ${SENTRY_RELEASE}
31
31
RUN touch sentry
32
32
33
33
# Build step #3: build the API with the client as static files
34
- FROM python:3.13 AS false
34
+ FROM python:3.13-alpine AS api-build
35
35
ARG SENTRY_RELEASE=""
36
36
WORKDIR /app
37
+
38
+ # Install required system dependencies
39
+ RUN apk add --no-cache python3 py3-pip py3-virtualenv
40
+
41
+ # Create a virtual environment for the application
42
+ RUN python3 -m venv /app/venv
43
+ ENV PATH="/app/venv/bin:$PATH"
44
+
37
45
COPY --from=build-step /app/build ./build
38
46
39
47
RUN rm ./build/static/js/*.map
40
48
RUN mkdir ./api && mkdir ./migrations
41
49
COPY requirements.txt api/ ./api/
42
50
COPY migrations/ ./migrations/
43
51
COPY ./config ./config
44
- RUN pip install -r ./api/requirements.txt
52
+
53
+ # Install dependencies inside the virtual environment
54
+ RUN pip install --no-cache-dir -r ./api/requirements.txt
45
55
46
56
# Build an image that includes the optional sentry release push build step
47
57
FROM false AS true
@@ -55,6 +65,9 @@ ENV FLASK_ENV=production
55
65
ENV FLASK_APP=api.app:create_app
56
66
ENV SENTRY_RELEASE=$SENTRY_RELEASE
57
67
68
+ # Ensure Flask uses the virtual environment
69
+ ENV PATH="/app/venv/bin:$PATH"
70
+
58
71
EXPOSE 3000
59
72
60
73
CMD ["gunicorn" , "-w" , "4" , "-t" , "600" , "-b" , ":3000" , "--access-logfile" , "-" , "api.wsgi:app" ]
0 commit comments