forked from sillsdev/TheCombine
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
55 lines (40 loc) · 1.4 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
# User guide build environment.
FROM python:3.10 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:16 AS frontend_builder
WORKDIR /app
# Install app dependencies.
COPY package*.json ./
RUN npm install
# Build application.
COPY . ./
RUN npm run build
# Production environment.
FROM nginx:1.23
WORKDIR /app
ENV USER_GUIDE_HOST_DIR /usr/share/nginx/user_guide
ENV FRONTEND_HOST_DIR /usr/share/nginx/html
RUN mkdir /etc/nginx/templates
RUN mkdir /etc/nginx/page_templates
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/