2022-01-20 00:35:11 +00:00
|
|
|
stages:
|
|
|
|
- build
|
|
|
|
- push
|
|
|
|
|
|
|
|
variables:
|
|
|
|
BUILT_IMAGE_TAG: built_image
|
2022-01-20 02:04:43 +00:00
|
|
|
IMAGE_TAG: ${CI_REGISTRY_IMAGE}
|
|
|
|
DOCKER_HUB_IMAGE_TAG: skobkin/murmur
|
2022-01-20 00:35:11 +00:00
|
|
|
DOCKER_HUB_LOGIN: skobkin
|
|
|
|
DOCKER_HUB_TOKEN: "xxx"
|
|
|
|
|
|
|
|
build:
|
2022-01-20 01:16:21 +00:00
|
|
|
# https://wiki.alpinelinux.org/wiki/Release_Notes_for_Alpine_3.14.0#faccessat2
|
2023-04-01 20:58:53 +00:00
|
|
|
image: docker:23.0.2
|
2022-01-20 00:35:11 +00:00
|
|
|
services:
|
2023-04-01 20:58:53 +00:00
|
|
|
- docker:23.0.2-dind
|
2022-01-20 00:35:11 +00:00
|
|
|
stage: build
|
|
|
|
script:
|
2022-01-20 01:00:30 +00:00
|
|
|
- docker build -t $BUILT_IMAGE_TAG --no-cache .
|
2022-01-20 00:35:11 +00:00
|
|
|
- docker save -o $CI_PROJECT_DIR/images.tar $BUILT_IMAGE_TAG
|
|
|
|
artifacts:
|
|
|
|
paths:
|
|
|
|
- images.tar
|
|
|
|
|
|
|
|
push-gitlab-registry:
|
2023-04-01 20:58:53 +00:00
|
|
|
image: docker:23.0.2
|
2022-01-20 00:35:11 +00:00
|
|
|
services:
|
2023-04-01 20:58:53 +00:00
|
|
|
- docker:23.0.2-dind
|
2022-01-20 00:35:11 +00:00
|
|
|
stage: push
|
2022-01-20 02:04:43 +00:00
|
|
|
only:
|
|
|
|
- tags
|
2022-01-20 00:35:11 +00:00
|
|
|
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
|
2022-01-20 02:04:43 +00:00
|
|
|
- docker tag $BUILT_IMAGE_TAG $IMAGE_TAG:$CI_COMMIT_TAG
|
2022-01-20 00:35:11 +00:00
|
|
|
- docker push $IMAGE_TAG
|
2022-01-20 02:04:43 +00:00
|
|
|
- docker push $IMAGE_TAG:$CI_COMMIT_TAG
|
2022-01-20 00:35:11 +00:00
|
|
|
|
|
|
|
push-docker-hub-registry:
|
2023-04-01 20:58:53 +00:00
|
|
|
image: docker:23.0.2
|
2022-01-20 00:35:11 +00:00
|
|
|
services:
|
2023-04-01 20:58:53 +00:00
|
|
|
- docker:23.0.2-dind
|
2022-01-20 00:35:11 +00:00
|
|
|
stage: push
|
2022-01-20 02:04:43 +00:00
|
|
|
only:
|
|
|
|
- tags
|
2022-01-20 00:35:11 +00:00
|
|
|
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
|
2022-01-20 02:04:43 +00:00
|
|
|
- docker tag $BUILT_IMAGE_TAG $DOCKER_HUB_IMAGE_TAG:$CI_COMMIT_TAG
|
2022-01-20 00:35:11 +00:00
|
|
|
- docker push $DOCKER_HUB_IMAGE_TAG
|
2022-01-20 02:17:55 +00:00
|
|
|
- docker push $DOCKER_HUB_IMAGE_TAG:$CI_COMMIT_TAG
|
2022-01-20 00:35:11 +00:00
|
|
|
|