-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
49 lines (41 loc) · 975 Bytes
/
.gitlab-ci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
default:
image: $DOCKER_REGISTRY/library/docker:20.10.12-ssh
cache:
paths:
- node_modules
- dist
stages:
- build
- image
build-job:
stage: build
image: $DOCKER_REGISTRY/library/node:20.11.0-slim-cert
script:
- echo '安装依赖'
- npm cache clean --force
- npm install --registry=$NPM_REGISTRY
- echo '开始构建'
- npm run build
tags:
- docker
package-job:
stage: image
services:
- name: $DOCKER_REGISTRY/library/docker:20.10.12-dind-cert
alias: docker
variables:
DOCKER_TLS_CERTDIR: "/certs"
IMAGE_NAME: $DOCKER_REGISTRY/portal/$CI_PROJECT_NAME
before_script:
- export IMAGE_TAG=`date "+%-y.%-m.%-d_%H%M%S"`
script:
- echo '构建镜像'
- docker build -t $IMAGE_NAME:$IMAGE_TAG .
- echo '推送镜像'
- mkdir -p $HOME/.docker
- echo $DOCKER_AUTH > $HOME/.docker/config.json
- docker push $IMAGE_NAME:$IMAGE_TAG
tags:
- docker
only:
- main