forked from mmtaee/ocserv-dashboard
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile-Web
More file actions
54 lines (37 loc) · 1.21 KB
/
Dockerfile-Web
File metadata and controls
54 lines (37 loc) · 1.21 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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
# ================================
# Vue.js build stage
# ================================
FROM node:20 AS vue
# Build-time arguments
ARG API_URL
ARG LOG_SOCKET_URL
ARG LANGUAGES
WORKDIR /app
# Copy package.json first to leverage Docker cache
COPY web/package*.json web/yarn.lock ./
RUN yarn install
# Copy all source files
COPY ./web .
# Build Vue app with environment variables
RUN NODE_ENV=production \
VITE_I18N_LANGUAGES="${LANGUAGES}" \
yarn run build
# ================================
# Nginx production stage
# ================================
FROM nginx:alpine
# Install bash, gettext (for envsubst), and openssl
RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.tuna.tsinghua.edu.cn/g' /etc/apk/repositories \
&& apk update \
&& apk add --no-cache bash gettext openssl \
&& rm -rf /etc/nginx/conf.d/default.conf /usr/share/nginx/html \
&& mkdir -p /var/www/site /etc/nginx/certs
# Copy custom Nginx startup script
COPY configs/nginx_docker.conf /etc/nginx/conf.d/site.conf
COPY scripts/nginx_entrypoint.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh
COPY --from=vue /app/dist /var/www/site
VOLUME ["/etc/nginx/certs"]
EXPOSE 80 443
ENTRYPOINT ["/entrypoint.sh"]
CMD ["nginx", "-g", "daemon off;"]