2024-05-12 17:40:08 +00:00
|
|
|
image: docker:cli
|
2024-05-12 17:19:06 +00:00
|
|
|
|
|
|
|
services:
|
|
|
|
- docker:dind
|
|
|
|
|
|
|
|
stages:
|
|
|
|
- build
|
2024-05-12 17:40:08 +00:00
|
|
|
- deploy
|
2024-05-12 17:19:06 +00:00
|
|
|
|
|
|
|
build:
|
|
|
|
stage: build
|
|
|
|
script:
|
|
|
|
- docker build -t $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG .
|
2024-05-12 17:40:08 +00:00
|
|
|
# Run this job in a branch where a Dockerfile exists
|
|
|
|
rules:
|
|
|
|
- if: $CI_COMMIT_BRANCH
|
|
|
|
exists:
|
|
|
|
- Dockerfile
|
|
|
|
|
|
|
|
deploy:
|
|
|
|
stage: deploy
|
|
|
|
script:
|
2024-05-12 17:19:06 +00:00
|
|
|
- docker push $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG
|
2024-05-12 17:40:08 +00:00
|
|
|
tags:
|
|
|
|
- docker
|
2024-05-12 17:19:06 +00:00
|
|
|
only:
|
|
|
|
- tags
|
2024-05-12 17:40:08 +00:00
|
|
|
when: on_success
|
2024-05-12 17:19:06 +00:00
|
|
|
|