feat(web): pwa offline caching, dockerized SPA, full-stack nginx smoke

This commit is contained in:
2026-09-07 16:33:50 +08:00
parent 1bd7688ee6
commit 96e96fec51
11 changed files with 133 additions and 8 deletions
+8 -1
View File
@@ -1,3 +1,10 @@
FROM node:22-alpine AS build
WORKDIR /src
COPY web/package.json web/package-lock.json ./
RUN npm ci
COPY web/ ./
RUN npm run build
FROM nginx:1.27-alpine
COPY deploy/nginx.conf /etc/nginx/conf.d/default.conf
COPY deploy/web-dist /usr/share/nginx/html
COPY --from=build /src/dist /usr/share/nginx/html
+2 -3
View File
@@ -1,11 +1,10 @@
server {
listen 80;
client_max_body_size 200m;
resolver 127.0.0.11 valid=10s;
location /api/ {
set $upstream http://api:8080; # 变量式 → 每次按 DNS 解析,scale 后轮询到新副本
proxy_pass $upstream; # 无 URI 部分:保留 /api 前缀转发
# 静态主机名:启动时经 /etc/resolv.conf 解析(Docker 127.0.0.11 / podman aardvark 均兼容)
proxy_pass http://api:8080; # 无 URI 部分:保留 /api 前缀转发
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
-1
View File
@@ -1 +0,0 @@
<!doctype html><title>booklib</title><p>backend up — frontend lands in Plan 2.</p>