init: UserBaseFront (frontend)
This commit is contained in:
@@ -0,0 +1,10 @@
|
||||
# UserBase 前端静态镜像(基于已构建好的 dist/prod)
|
||||
# 构建上下文 = front 目录: docker build -f docker/Dockerfile -t <img> .
|
||||
# 说明:caddy 用 handle_path /userbase/* 剥掉前缀后转发进来,故 nginx 直接以 / 提供服务
|
||||
FROM nginx:1.27-alpine
|
||||
|
||||
RUN rm -rf /usr/share/nginx/html/*
|
||||
COPY dist/prod/ /usr/share/nginx/html/
|
||||
COPY docker/nginx.conf /etc/nginx/conf.d/default.conf
|
||||
|
||||
EXPOSE 80
|
||||
@@ -0,0 +1,26 @@
|
||||
server {
|
||||
listen 80;
|
||||
server_name _;
|
||||
|
||||
root /usr/share/nginx/html;
|
||||
index index.html;
|
||||
|
||||
gzip on;
|
||||
gzip_min_length 1k;
|
||||
gzip_comp_level 5;
|
||||
gzip_types text/plain text/css application/javascript application/json image/svg+xml;
|
||||
|
||||
# hash 路由,所有非静态资源请求回落到 index.html
|
||||
location / {
|
||||
try_files $uri $uri/ /index.html;
|
||||
}
|
||||
|
||||
location ~* \.(js|css|png|jpe?g|gif|svg|woff2?|ttf|eot)$ {
|
||||
expires 7d;
|
||||
add_header Cache-Control "public, max-age=604800";
|
||||
}
|
||||
|
||||
location = /index.html {
|
||||
add_header Cache-Control "no-cache, no-store, must-revalidate";
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user