File tree Expand file tree Collapse file tree 5 files changed +55
-22
lines changed Expand file tree Collapse file tree 5 files changed +55
-22
lines changed Original file line number Diff line number Diff line change
1
+ FROM node:18.20-alpine as Builder
2
+
3
+ WORKDIR /space
4
+
5
+ COPY . .
6
+
7
+ RUN apk add git \
8
+ && git config --global url."https://" .insteadOf git:// \
9
+ && npm install --registry=http://registry.npmmirror.com
10
+
11
+ ENV NODE_PATH=/space/node_modules
Original file line number Diff line number Diff line change 6
6
- docker
7
7
- git-clone-yyds
8
8
stages :
9
+ - name : 构建缓存镜像
10
+ type : docker:cache
11
+ options :
12
+ dockerfile : cache.dockerfile
13
+ by :
14
+ - package.json
15
+ - package-lock.json
16
+ versionBy :
17
+ - package.json
18
+ exports :
19
+ name : DOCKER_CACHE_IMAGE_NAME
20
+ - name : 直接使用缓存镜像环境安装依赖并编译
21
+ image : $DOCKER_CACHE_IMAGE_NAME
22
+ script : |
23
+ ln -snf $NODE_PATH node_modules
24
+ time npm install
25
+ sed -i 's@http://localhost:8888/@/@g' .env.production
26
+ time yarn build:prod
9
27
- name : 🐋 推送镜像
10
28
script : |
11
29
docker run -d --name buildkitd \
Original file line number Diff line number Diff line change 6
6
- docker
7
7
- git-clone-yyds
8
8
stages :
9
- - name : 📦 构建制品
10
- image : docker.cnb.cool/znb/images/debian:all
9
+ - name : 构建缓存镜像
10
+ type : docker:cache
11
+ options :
12
+ dockerfile : cache.dockerfile
13
+ by :
14
+ - package.json
15
+ - package-lock.json
16
+ versionBy :
17
+ - package.json
18
+ exports :
19
+ name : DOCKER_CACHE_IMAGE_NAME
20
+ - name : 直接使用缓存镜像环境安装依赖并编译
21
+ image : $DOCKER_CACHE_IMAGE_NAME
11
22
script : |
23
+ ln -snf $NODE_PATH node_modules
24
+ time npm install
12
25
sed -i 's@http://localhost:8888/@/@g' .env.production
13
- npm install --registry=http://registry.npmmirror.com
14
- yarn build:prod
26
+ time yarn build:prod
27
+ - name : 📦 构建制品
28
+ image : docker.cnb.cool/znb/images/debian
29
+ script : |
15
30
zip -q -r dist.zip dist
16
31
openssl md5 dist.zip > dist.zip.md5
17
32
- name : 🐋 推送制品
Original file line number Diff line number Diff line change @@ -12,14 +12,16 @@ jobs:
12
12
runs-on : ubuntu-latest
13
13
steps :
14
14
- name : Checkout 🛎️
15
- uses : actions/checkout@v3
15
+ uses : actions/checkout@v5
16
16
- name : Inject slug/short variables
17
- uses : rlespinasse/github-slug-action@v4
17
+ uses : rlespinasse/github-slug-action@v5
18
18
19
19
- name : build project ⚗️
20
- uses : actions/setup-node@v3
20
+ uses : actions/setup-node@v5
21
21
with :
22
22
node-version : 14
23
+ cache : ' npm'
24
+ cache-dependency-path : " package-lock.json"
23
25
24
26
- run : |
25
27
sed -i 's@http://localhost:8888/@/@g' .env.production
32
34
openssl md5 dist.zip > dist.zip.md5
33
35
34
36
- name : Upload release package
35
- uses : softprops/action-gh-release@v1
37
+ uses : softprops/action-gh-release@v2
36
38
with :
37
39
files : |
38
40
dist.zip
Original file line number Diff line number Diff line change 1
- # 此 Dockerfile 仅用于构建可复制的 dist 内容,并不包含运行环境
2
- # 第一阶段构建不区分平台,可通过指定 --platform=linux/amd64 来声明环境
3
- FROM --platform=linux/amd64 docker.cnb.cool/znb/images/node:18 AS builder
4
-
5
- WORKDIR /app
6
-
7
- ADD . .
8
-
9
- RUN sed -i 's@http://localhost:8888/@/@g' .env.production \
10
- && git config --global url."https://" .insteadOf git:// \
11
- && npm install --registry=http://registry.npmmirror.com \
12
- && yarn build:prod
13
-
14
1
FROM docker.cnb.cool/znb/images/alpine
15
2
16
3
WORKDIR /app
17
4
18
- COPY --from=builder /app/ dist/ dist/
5
+ COPY dist ./dist
You can’t perform that action at this time.
0 commit comments