From 09a0295c6f7675dc7a5791b3ce609f7f03714b1f Mon Sep 17 00:00:00 2001 From: juetan Date: Mon, 23 Oct 2023 19:09:14 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=B7=BB=E5=8A=A0nginx=E9=85=8D?= =?UTF-8?q?=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/nginx.conf | 15 +++++++++++++++ Dockerfile | 12 +++++++++++- 2 files changed, 26 insertions(+), 1 deletion(-) create mode 100644 .github/nginx.conf diff --git a/.github/nginx.conf b/.github/nginx.conf new file mode 100644 index 0000000..bd5ea94 --- /dev/null +++ b/.github/nginx.conf @@ -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; + } +} diff --git a/Dockerfile b/Dockerfile index 29ae2e5..384b3b0 100644 --- a/Dockerfile +++ b/Dockerfile @@ -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;"] \ No newline at end of file