docker-murmur/.gitlab-ci.yml

46 lines
1 KiB
YAML

stages:
- build
- push
variables:
BUILT_IMAGE_TAG: built_image
IMAGE_TAG: $CI_REGISTRY_IMAGE
DOCKER_HUB_IMAGE_TAG: "skobkin/murmur:latest"
DOCKER_HUB_LOGIN: skobkin
DOCKER_HUB_TOKEN: "xxx"
build:
image: docker:19.03.12
services:
- docker:19.03.12-dind
stage: build
script:
- docker build -t $BUILT_IMAGE_TAG --no-cache .
- docker save -o $CI_PROJECT_DIR/images.tar $BUILT_IMAGE_TAG
artifacts:
paths:
- images.tar
push-gitlab-registry:
image: docker:19.03.12
services:
- docker:19.03.12-dind
stage: push
script:
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
- docker load -i images.tar
- docker tag $BUILT_IMAGE_TAG $IMAGE_TAG
- docker push $IMAGE_TAG
push-docker-hub-registry:
image: docker:19.03.12
services:
- docker:19.03.12-dind
stage: push
script:
- docker login -u $DOCKER_HUB_LOGIN -p $DOCKER_HUB_TOKEN
- docker load -i images.tar
- docker tag $BUILT_IMAGE_TAG $DOCKER_HUB_IMAGE_TAG
- docker push $DOCKER_HUB_IMAGE_TAG