-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy path.gitlab-ci.yml
36 lines (33 loc) · 1021 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
image: node:latest
stages:
- build
- deploy
#使用CI的yarn生成静态文件
build:
stage: build
script:
- rm -rf dist/
- yarn install
- yarn build
- cp src/config.json dist/
artifacts:
paths:
- dist/
#生成支持amd64/arm64平台的镜像
deploy:
stage: deploy
image: jdrouet/docker-with-buildx:stable
services:
- docker:dind
before_script:
- docker login -u $CI_CUSTOMREGISTRY_USER -p $CI_CUSTOMREGISTRY_PASS $CI_CUSTOMREGISTRY_IMAGEBASE
variables:
CONTAINER_REGISTRY_IMAGE: $CI_CUSTOMREGISTRY_IMAGEBASE/sbim/sdwc
script:
#默认的Dockerfile构建arm64特别慢,直接用CI的dist目录复制到amd64镜像中
- rm Dockerfile
- mv Dockerfile-deploy Dockerfile
- docker buildx create --name builderx
- docker buildx use builderx
- docker buildx inspect --bootstrap
- docker buildx build --platform linux/amd64,linux/arm64 --tag $CONTAINER_REGISTRY_IMAGE:$CI_COMMIT_SHORT_SHA --tag $CONTAINER_REGISTRY_IMAGE:latest --push .