build: add production frontend images

This commit is contained in:
hajimi
2026-08-02 11:21:43 +08:00
parent 796648ac04
commit 63cc403988
6 changed files with 120 additions and 0 deletions
+19
View File
@@ -0,0 +1,19 @@
# syntax=docker/dockerfile:1
FROM node:20-alpine AS build
WORKDIR /app
COPY package.json package-lock.json ./
RUN npm ci --no-audit --no-fund
COPY . .
ARG VITE_APP_BASE_URL=https://api.sbnews.net
ENV VITE_APP_BASE_URL=${VITE_APP_BASE_URL}
RUN npx vite build
FROM registry.cn-guangzhou.aliyuncs.com/likeadmin/nginx:1.23.1
COPY --from=build /app/dist/ /usr/share/nginx/html/
+21
View File
@@ -0,0 +1,21 @@
# syntax=docker/dockerfile:1
FROM node:20-alpine AS build
WORKDIR /app
COPY package.json package-lock.json ./
RUN npm ci --legacy-peer-deps --no-audit --no-fund
COPY . .
ARG VITE_APP_BASE_URL=https://api.sbnews.net
ENV VITE_APP_BASE_URL=${VITE_APP_BASE_URL} \
UNIAPP_RELEASE_PATH=/tmp/mobile-release \
NODE_OPTIONS=--max-old-space-size=4096
RUN npm run build:h5
FROM registry.cn-guangzhou.aliyuncs.com/likeadmin/nginx:1.23.1
COPY --from=build /app/dist/build/h5/ /usr/share/nginx/html/
+30
View File
@@ -0,0 +1,30 @@
server {
listen 127.0.0.1:5176;
server_name keislwo.sbnews.net;
root /usr/share/nginx/html;
index index.html;
access_log /var/log/nginx/admin_access.log;
error_log /var/log/nginx/admin_error.log;
location = /healthz {
access_log off;
default_type text/plain;
return 200 "ok\n";
}
location = /index.html {
add_header Cache-Control "no-cache";
}
location / {
try_files $uri $uri/ /index.html;
}
location ~* \.(?:css|js|jpg|jpeg|gif|png|svg|ico|webp|woff2?)$ {
expires 7d;
add_header Cache-Control "public, immutable";
try_files $uri =404;
}
}
+30
View File
@@ -0,0 +1,30 @@
server {
listen 127.0.0.1:5177;
server_name web.sbnews.net;
root /usr/share/nginx/html;
index index.html;
access_log /var/log/nginx/h5_access.log;
error_log /var/log/nginx/h5_error.log;
location = /healthz {
access_log off;
default_type text/plain;
return 200 "ok\n";
}
location = /index.html {
add_header Cache-Control "no-cache";
}
location / {
try_files $uri $uri/ /index.html;
}
location ~* \.(?:css|js|jpg|jpeg|gif|png|svg|ico|webp|woff2?)$ {
expires 7d;
add_header Cache-Control "public, immutable";
try_files $uri =404;
}
}