-
-
Notifications
You must be signed in to change notification settings - Fork 13
/
Dockerfile
65 lines (49 loc) · 1.67 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
############################################################
# IMPORTANT
#
# Supported Platforms:
# - Intel/AMD 64-bit
# - ARM 64-bit
############################################################
# User guide build environment
FROM python:3.12.5-slim-bookworm AS user_guide_builder
ENV PYTHONDONTWRITEBYTECODE=1
ENV PYTHONUNBUFFERED=1
ENV PIP_NO_CACHE_DIR=1
WORKDIR /app
RUN pip install --upgrade pip && \
pip install tox
COPY dev-requirements.txt tox.ini ./
COPY docs/user_guide docs/user_guide
RUN tox -e user-guide
# Frontend build environment.
FROM node:20.17.0-bookworm-slim AS frontend_builder
WORKDIR /app
# Install app dependencies.
COPY package*.json ./
RUN npm ci
# Build application.
COPY . ./
RUN npm run build
# Production environment.
FROM nginx:1.27
WORKDIR /app
ENV HOST_DIR=/usr/share/nginx
ENV USER_GUIDE_HOST_DIR=${HOST_DIR}/user_guide
ENV FRONTEND_HOST_DIR=${HOST_DIR}/html
RUN mkdir /etc/nginx/templates
RUN mkdir /etc/nginx/page_templates
RUN mkdir ${HOST_DIR}/fonts
RUN mkdir ${FRONTEND_HOST_DIR}/scripts
RUN mkdir ${FRONTEND_HOST_DIR}/url_moved
# Setup web content
COPY --from=user_guide_builder /app/docs/user_guide/site ${USER_GUIDE_HOST_DIR}
COPY --from=frontend_builder /app/build ${FRONTEND_HOST_DIR}
COPY nginx/pages/url_moved_home.html /etc/nginx/page_templates/url_moved_home.html
COPY public/favicon.ico ${FRONTEND_HOST_DIR}/url_moved/favicon.ico
COPY src/resources/tractor.png ${FRONTEND_HOST_DIR}/url_moved/tractor.png
COPY public/scripts/release.js ${FRONTEND_HOST_DIR}/scripts/release.js
# Setup nginx configuration templates
COPY nginx/templates/* /etc/nginx/templates/
# Copy additional configuration scripts
COPY nginx/init/* /docker-entrypoint.d/