File tree Expand file tree Collapse file tree 2 files changed +36
-20
lines changed Expand file tree Collapse file tree 2 files changed +36
-20
lines changed Original file line number Diff line number Diff line change
1
+ # Build Docker image for test
2
+ .build-and-push-gitlab :
3
+ image : docker:24.0.2
4
+ services :
5
+ - docker:24.0.2-dind
6
+ variables :
7
+ DOCKER_BUILDKIT : 1
8
+ DOCKER_IMAGE_NAME : $CI_PROJECT_NAME
9
+ DOCKER_IMAGE_TAG : $CI_COMMIT_SHA
10
+ DOCKER_IMAGE_TAG_SUFFIX : " "
11
+ DOCKER_PLATFORM : " linux/arm64,linux/amd64"
12
+ DOCKER_TARGET : dev
13
+ before_script :
14
+ - apk add --no-cache qemu bash git
15
+ script :
16
+ - docker buildx create --use
17
+ - docker buildx inspect --bootstrap
18
+ - |
19
+ docker buildx build --load \
20
+ --target=$DOCKER_TARGET \
21
+ --tag=$DOCKER_IMAGE_NAME:$DOCKER_IMAGE_TAG$DOCKER_IMAGE_TAG_SUFFIX \
22
+ --platform=$DOCKER_PLATFORM \
23
+ --cache-to=type=local,dest=/tmp/.buildx-cache \
24
+ --cache-from=type=local,src=/tmp/.buildx-cache \
25
+ .
26
+ artifacts :
27
+ paths :
28
+ - /tmp/.buildx-cache
29
+ expire_in : 1h
Original file line number Diff line number Diff line change 1
1
# Build Docker image for test
2
2
build-test :
3
3
stage : build
4
- image : docker:24.0.2
5
- services :
6
- - docker:24.0.2-dind
7
4
variables :
8
- DOCKER_BUILDKIT : 1
9
- before_script :
10
- - apk add --no-cache qemu bash git
11
- script :
12
- - docker buildx create --use
13
- - docker buildx inspect --bootstrap
14
- - |
15
- docker buildx build --load --target=dev --tag=$TEST_TAG \
16
- --cache-to=type=local,dest=/tmp/.buildx-cache \
17
- --cache-from=type=local,src=/tmp/.buildx-cache \
18
- .
19
- artifacts :
20
- paths :
21
- - /tmp/.buildx-cache
22
- expire_in : 1h
23
-
24
-
5
+ DOCKER_IMAGE_TAG_SUFFIX : " -test"
6
+ rules :
7
+ # We run the pipeline only on merge requests or the `main` branch
8
+ - if : $CI_COMMIT_REF_NAME == $CI_DEFAULT_BRANCH
9
+ - if : $CI_PIPELINE_SOURCE == "merge_request_event"
10
+ extends :
11
+ - .build-and-push-gitlab
You can’t perform that action at this time.
0 commit comments