desultd/.gitlab-ci.yml

56 lines
1.4 KiB
YAML
Raw Permalink Normal View History

2021-04-08 14:14:42 -05:00
#
# This guy is awesome: https://dev.to/bzinoun/gitlab-ci-to-build-and-push-containers-to-registry-538a
#
image: morlay/buildx:607a2ce
variables:
# DinD's vfs driver is pretty intensive; this is less so
DOCKER_DRIVER: overlay2
CI_HUB_USERNAME: rehashedsalt
stages:
- build
# - test
2021-08-01 15:09:26 -05:00
- deploy
2021-04-08 14:14:42 -05:00
services:
- docker:dind
before_script:
- echo -n "$CI_LOGIN_PASSWORD" | docker login -u "$CI_LOGIN_USERNAME" --password-stdin
- docker version
- docker info
after_script:
- docker logout hub.docker.com
# BUILD
Build:
stage: build
script:
- docker pull $CI_HUB_USERNAME/$CI_PROJECT_NAME:latest || true
- docker buildx create --use
- >
docker buildx build
--pull
--platform linux/amd64,linux/arm64
--cache-from $CI_HUB_USERNAME/$CI_PROJECT_NAME:latest
--tag $CI_HUB_USERNAME/$CI_PROJECT_NAME:$CI_COMMIT_SHORT_SHA
--tag $CI_HUB_USERNAME/$CI_PROJECT_NAME:bleeding
2021-04-08 14:14:42 -05:00
--push
.
- docker images
Build_Tag:
stage: build
2021-04-08 14:14:42 -05:00
only:
- tags
script:
- docker pull $CI_HUB_USERNAME/$CI_PROJECT_NAME:latest || true
- docker buildx create --use
2021-04-08 14:14:42 -05:00
- >
docker buildx build
--pull
--platform linux/amd64,linux/arm64
--cache-from $CI_HUB_USERNAME/$CI_PROJECT_NAME:latest
--tag $CI_HUB_USERNAME/$CI_PROJECT_NAME:$CI_COMMIT_REF_NAME
--tag $CI_HUB_USERNAME/$CI_PROJECT_NAME:latest
--push
.
2021-04-08 14:14:42 -05:00
- docker images