-
Notifications
You must be signed in to change notification settings - Fork 18
Expand file tree
/
Copy path.gitlab-ci.yml
More file actions
26 lines (22 loc) · 863 Bytes
/
.gitlab-ci.yml
File metadata and controls
26 lines (22 loc) · 863 Bytes
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
variables:
GIT_STRATEGY: fetch
GIT_SSL_NO_VERIFY: "true"
GIT_LFS_SKIP_SMUDGE: 1
DOCKER_BUILDKIT: 1
BUILDX_VERSION: "v0.11.0"
BUILDX_ARCH: "linux-amd64"
stages:
- build
image_build:
stage: build
image: docker:stable-git
before_script:
- docker login -u gitlab-ci-token -p $CI_JOB_TOKEN http://$CI_REGISTRY
- wget -O /usr/bin/docker-buildx
https://github.com/docker/buildx/releases/download/${BUILDX_VERSION}/buildx-${BUILDX_VERSION}.${BUILDX_ARCH}
- chmod +x /usr/bin/docker-buildx
script: |
LAST_CHANGE=$(git log -n 1 --pretty=format:%H -- $(cat .envfiles) | cut -c1-7)
CURRENT_COMMIT=$(git rev-parse HEAD | cut -c1-7)
docker-buildx imagetools create $CI_REGISTRY_IMAGE:$LAST_CHANGE --tag $CI_REGISTRY_IMAGE:$CURRENT_COMMIT || \
docker-buildx build --push --tag $CI_REGISTRY_IMAGE:$CURRENT_COMMIT .