-
-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathDockerfile
43 lines (35 loc) · 1.24 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
FROM python:3.12-bookworm AS build-stage
WORKDIR /app
ARG GIT_COMMIT_SHA
ENV GIT_COMMIT_SHA=${GIT_COMMIT_SHA}
# install requirements
COPY requirements.txt .
RUN pip3 install -r requirements.txt
# collect data
COPY sources/ sources/
COPY external/ external/
COPY processors/ processors/
COPY *.py ./
COPY translations.yaml translations.yaml
COPY output output
RUN python3 compile.py \
&& test -f "./output/openapi.yaml" \
&& test -f "./output/status_data.json" \
&& test -f "./output/status_data.parquet" \
&& test -f "./output/search_data.json" \
&& test -f "./output/search_data.parquet" \
&& test -f "./output/api_data.json" \
&& test -f "./output/api_data.parquet"
RUN cp -r sources/img/* output \
&& cp -r output/maps/site_plans output/maps/roomfinder \
&& cp -r output/maps/overlays output/maps/overlay
# last renaming is to remain backwards compatible
# compress data (only using gzip, because brotli on ngnix is a royal pain)
RUN gzip --force --keep --recursive output/
FROM nginx:1.27 AS production-stage
RUN mkdir /cdn
COPY --from=build-stage /app/output /cdn
COPY nginx.conf /etc/nginx/nginx.conf
EXPOSE 3002
HEALTHCHECK CMD curl --fail http://localhost:3002/cdn/health || exit 1
CMD ["nginx", "-g", "daemon off;"]