-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
yuanjunjie
committed
Jul 3, 2024
1 parent
3266dc5
commit 2f602f0
Showing
9 changed files
with
92 additions
and
501 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
version: "3" | ||
|
||
networks: | ||
web_net: | ||
external: true | ||
|
||
services: | ||
vueui: | ||
container_name: vue-vben-admin | ||
image: swr.cn-north-4.myhuaweicloud.com/yuanjunjie/vue-vben-admin:dev | ||
build: | ||
context: ./vue-vben-admin | ||
dockerfile: ./vue-vben-admin/Dockerfile | ||
restart: always | ||
ports: | ||
- 5173:80 | ||
depends_on: | ||
- servers | ||
|
||
servers: | ||
container_name: nest-admin | ||
image: swr.cn-north-4.myhuaweicloud.com/yuanjunjie/nest-admin:dev | ||
build: | ||
context: ./nest-admin/servers | ||
dockerfile: ./nest-admin/servers/Dockerfile | ||
command: npm run start:docker | ||
restart: always | ||
ports: | ||
- 8080:8080 | ||
volumes: | ||
- upload:/nest-admin/upload | ||
|
||
volumes: | ||
upload: |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
FROM node:16 | ||
FROM node:22.3.0 as builder | ||
|
||
CMD [ "mkdir", "/upload" ] | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,10 @@ | ||
# node 构建 | ||
FROM node:16-alpine as build-stage | ||
# 署名 | ||
MAINTAINER Adoin '[email protected]' | ||
# ================== STEP 1: Build ================== | ||
FROM node:22.3.0 as builder | ||
|
||
# 将源码复制到 /app 目录中 | ||
WORKDIR /app | ||
COPY . ./ | ||
COPY . . | ||
|
||
# 设置 node 阿里镜像 | ||
RUN npm config set registry https://registry.npmmirror.com | ||
# 设置--max-old-space-size | ||
|
@@ -14,12 +15,23 @@ RUN npm install pnpm -g && \ | |
pnpm build:docker | ||
# node部分结束 | ||
RUN echo "🎉 编 🎉 译 🎉 成 🎉 功 🎉" | ||
# nginx 部署 | ||
FROM nginx:1.23.3-alpine as production-stage | ||
COPY --from=build-stage /app/dist /usr/share/nginx/html/dist | ||
COPY --from=build-stage /app/nginx.conf /etc/nginx/nginx.conf | ||
|
||
# ================== STEP 2: Publish ================== | ||
FROM nginx:1.19.6 | ||
|
||
# 复制 nginx.conf 配置文件到镜像中 | ||
COPY ["./_nginx/default.conf", "/etc/nginx/nginx.conf"] | ||
|
||
# 删除 nginx html 原有内容 | ||
RUN rm -rf /usr/share/nginx/html/* | ||
|
||
EXPOSE 80 | ||
|
||
# 从编译镜像复制编译结果到此镜像 | ||
COPY --from=builder /app/dist /usr/share/nginx/html | ||
|
||
## 将/usr/share/nginx/html/dist/assets/index.js 和/usr/share/nginx/html/dist/_app.config.js中的"$vg_base_url"替换为环境变量中的VG_BASE_URL,$vg_sub_domain 替换成VG_SUB_DOMAIN,$vg_default_user替换成VG_DEFAULT_USER,$vg_default_password替换成VG_DEFAULT_PASSWORD 而后启动nginx | ||
CMD sed -i "s|__vg_base_url|$VG_BASE_URL|g" /usr/share/nginx/html/dist/assets/entry/index-*.js /usr/share/nginx/html/dist/_app.config.js && \ | ||
nginx -g 'daemon off;' | ||
# CMD sed -i "s|__vg_base_url|$VG_BASE_URL|g" /usr/share/nginx/html/dist/assets/entry/index-*.js /usr/share/nginx/html/dist/_app.config.js && \ | ||
# nginx -g 'daemon off;' | ||
|
||
RUN echo "🎉 架 🎉 设 🎉 成 🎉 功 🎉" |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.