-
Notifications
You must be signed in to change notification settings - Fork 43
Expand file tree
/
Copy pathDockerfile
More file actions
36 lines (26 loc) · 1.18 KB
/
Dockerfile
File metadata and controls
36 lines (26 loc) · 1.18 KB
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
FROM node:20-alpine AS builder
WORKDIR /app
COPY frontend ./
RUN if [ -f package-lock.json ]; then npm ci; else npm install; fi && \
npm run build
FROM nginx:1.29 AS runner
RUN --mount=type=cache,target=/var/cache/apt \
--mount=type=cache,target=/var/lib/apt \
apt update \
&& apt install -y dos2unix python3 python3-dev python3-venv libaugeas-dev gcc vim cron \
&& python3 -m venv /opt/certbot/ \
&& /opt/certbot/bin/pip install --upgrade pip \
&& /opt/certbot/bin/pip install certbot certbot-nginx \
&& ln -s /opt/certbot/bin/certbot /usr/local/bin/certbot
COPY --from=builder /app/dist /opt/frontend/statics
COPY scripts/images/frontend/routes.inc /opt/frontend/routes.inc
COPY scripts/images/frontend/http_backend.conf /opt/frontend/http_backend.conf
COPY scripts/images/frontend/https_backend.conf /opt/frontend/https_backend.conf
COPY scripts/images/frontend/start.sh /opt/frontend/start.sh
RUN dos2unix /opt/frontend/start.sh \
&& chmod +x /opt/frontend/start.sh \
&& mkdir -p /etc/nginx/cert \
&& ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime \
&& rm -f /etc/nginx/conf.d/default.conf
EXPOSE 3000
CMD ["/opt/frontend/start.sh"]