feat: 添加nginx配置

master
绝弹 2023-10-23 19:09:14 +08:00
parent 6c196f9efb
commit 09a0295c6f
2 changed files with 26 additions and 1 deletions

15
.github/nginx.conf vendored Normal file
View File

@ -0,0 +1,15 @@
server {
listen 80;
listen [::]:80;
server_name localhost;
location / {
root /usr/share/nginx/html;
index index.html index.htm;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
}

View File

@ -1,5 +1,15 @@
FROM node:20-alpine as build
WORKDIR /app
COPY ./package.json .
COPY ./pnpm-lock.yaml .
RUN corepack enable
RUN pnpm install --registry https://registry.npmmirror.com/
COPY . .
RUN pnpm build
FROM nginx:alpine
COPY ./dist /usr/share/nginx/html
COPY --from=build /app/dist /usr/share/nginx/html
COPY --from=build /app/.github/nginx.conf /etc/nginx/conf.d/default.conf
EXPOSE 80
CMD ["nginx", "-g", "daemon off;"]