Skip to content
This repository has been archived by the owner on Aug 28, 2024. It is now read-only.

Commit

Permalink
feat: docker
Browse files Browse the repository at this point in the history
  • Loading branch information
likui628 committed Dec 28, 2023
1 parent cee6f74 commit a84cd2d
Show file tree
Hide file tree
Showing 4 changed files with 938 additions and 401 deletions.
3 changes: 3 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
node_modules/
dist/
.vscode/
25 changes: 25 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
FROM node:20-slim AS build
RUN npm config set registry https://registry.npmmirror.com

COPY . /usr/src/app
WORKDIR /usr/src/app
RUN npm install pnpm -g && \
pnpm install --frozen-lockfile

# RUN pnpm --filter "./apps/**" build
RUN pnpm --filter=@apps/admin build
RUN pnpm deploy --filter=@apps/admin --prod /prod/admin
# RUN pnpm deploy --filter=@apps/gf-vben --prod /prod/gf-vben

FROM nginx:1.24.0-alpine as admin
COPY --from=build /prod/admin/dist /usr/share/nginx/html
COPY --from=build /usr/src/app/nginx.conf /etc/nginx/nginx.conf
EXPOSE 80
CMD ["nginx", "-g", "daemon off;"]

#FROM nginx:1.24.0-alpine as gf-vben
#COPY --from=build /prod/gf-vben /usr/share/nginx/html
#COPY --from=build /app/nginx.conf /etc/nginx/nginx.conf
#EXPOSE 80


26 changes: 26 additions & 0 deletions nginx.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
user nginx;
worker_processes 1;

error_log /var/log/nginx/error.log warn;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
}

http {
include mime.types;
default_type application/octet-stream;
server {
listen 80;
location / {
root /usr/share/nginx/html;
index index.html;
try_files $uri $uri/ /index.html;
index index.html;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
}
}
Loading

0 comments on commit a84cd2d

Please sign in to comment.