feat: add deploy script

This commit is contained in:
tangtaoit 2023-08-09 14:46:18 +08:00
parent 4a3118aac8
commit 0eb7fa8550
6 changed files with 5071 additions and 8 deletions

View File

@ -1,8 +1,16 @@
# 引用镜像
FROM node:16.20.1 as builder
WORKDIR /app
RUN npm config set registry https://registry.npm.taobao.org
RUN npm install pnpm -g
COPY . .
RUN pnpm install && pnpm build
FROM nginx:latest
LABEL maintainer="zp"
# 将项目根目录下dist文件夹下的所有文件复制到镜像中 /usr/share/nginx/html/ 目录下
COPY dist/ /usr/share/nginx/html/
COPY default.conf /etc/nginx/conf.d/default.conf
COPY --from=builder /app/docker-entrypoint.sh /docker-entrypoint2.sh
COPY --from=builder /app/nginx.conf.template /
COPY --from=builder /app/dist /usr/share/nginx/html
ENTRYPOINT ["sh", "/docker-entrypoint2.sh"]
CMD ["nginx","-g","daemon off;"]

6
Makefile Normal file
View File

@ -0,0 +1,6 @@
build:
docker build -t tangsengdaodaomanager .
deploy:
docker build -t tangsengdaodaomanager .
docker tag tangsengdaodaomanager registry.cn-shanghai.aliyuncs.com/wukongim/tangsengdaodaomanager:latest
docker push registry.cn-shanghai.aliyuncs.com/wukongim/tangsengdaodaomanager:latest

8
docker-entrypoint.sh Normal file
View File

@ -0,0 +1,8 @@
#!/usr/bin/env sh
set -eu
envsubst '${API_URL}' < /nginx.conf.template > /etc/nginx/conf.d/default.conf
exec "$@"

26
nginx.conf.template Normal file
View File

@ -0,0 +1,26 @@
gzip on;
gzip_min_length 1k;
gzip_disable msie6;
gzip_vary on;
gzip_proxied any;
gzip_comp_level 2;
gzip_buffers 16 8k;
gzip_http_version 1.1;
gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript;
server {
listen 80;
server_name localhost;
location /api/ {
proxy_pass ${API_URL};
client_max_body_size 1000m;
client_body_buffer_size 500m;
}
location / {
root /usr/share/nginx/html;
index index.html index.htm;
}
}

View File

@ -14,5 +14,6 @@ export const ROUTER_WHITE_LIST: string[] = ['/login'];
export const BU_DOU_CONFIG = {
APP_TITLE: '唐僧叨叨后台管理',
APP_TITLE_SHORT: '唐僧',
APP_URL: 'https://api.botgate.cn/v1/'
// APP_URL: 'https://api.botgate.cn/v1/'
APP_URL: '/api/v1/' // 正式环境地址 (通用打包镜像,用此相对地址)
};

5014
yarn.lock Normal file

File diff suppressed because it is too large Load Diff