Skip to content

Commit

Permalink
.gitlab-ci.yml: docker push
Browse files Browse the repository at this point in the history
  • Loading branch information
alesmrazek committed Oct 29, 2024
1 parent 39d0fb3 commit b16db91
Showing 1 changed file with 25 additions and 7 deletions.
32 changes: 25 additions & 7 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -197,25 +197,43 @@ build:macOS:
- pip3 install -U requests
- python3 ./ci/gh_actions.py ${CI_COMMIT_REF_NAME} ${CI_COMMIT_SHA}

docker:
.docker: &docker
<<: *nodep
stage: build
image: docker:latest
<<: *multi_platform
variables:
DOCKER_IMAGE_NAME: cznic/knot-resolver:test
only:
refs:
- branches@knot/knot-resolver
tags:
- ${PLATFORM}
- amd64
- dind
variables:
DOCKER_IMAGE_NAME: knot-resolver-test:${CI_COMMIT_SHA}

docker:build:
<<: *docker
stage: build
script:
- docker build --no-cache -t ${DOCKER_IMAGE_NAME} .
- >
docker buildx build --no-cache
--platform linux/amd64,linux/arm/v7,linux/arm64/v8
--tag ${DOCKER_IMAGE_NAME} .
# TODO: perhaps try if the running image answers queries
after_script: # remove dangling images to avoid running out of disk space
- docker rmi ${DOCKER_IMAGE_NAME}
- docker rmi $(docker images -f "dangling=true" -q)

docker:push:
stage: deploy
needs:
- docker:build
script:
- docker login --username ${DOCKER_HUB_USER} --password ${DOCKER_HUB_TOKEN}
- docker push $DOCKER_IMAGE_NAME
after_script: # remove dangling images to avoid running out of disk space
- docker rmi ${DOCKER_IMAGE_NAME}
- docker rmi $(docker images -f "dangling=true" -q)
when: manual

# }}}

# sanity {{{
Expand Down

0 comments on commit b16db91

Please sign in to comment.