2022-11-28 21:19:27 +00:00
|
|
|
---
|
|
|
|
kind: pipeline
|
|
|
|
type: docker
|
|
|
|
name: default
|
|
|
|
environment:
|
2022-11-30 21:15:35 +00:00
|
|
|
CI_REGISTRY_IMAGE: "git.valvin.fr/valvin/gemini-agate-image"
|
2022-11-28 21:19:27 +00:00
|
|
|
IMAGE_TAG: "latest"
|
|
|
|
|
|
|
|
steps:
|
|
|
|
- name: test_build_image
|
|
|
|
image: gcr.io/kaniko-project/executor:v1.7.0-debug
|
|
|
|
commands:
|
|
|
|
- echo "testing build image without push"
|
|
|
|
- /kaniko/executor --context $DRONE_WORKSPACE --dockerfile Dockerfile --destination $CI_REGISTRY_IMAGE:$IMAGE_TAG --no-push
|
|
|
|
when:
|
|
|
|
event:
|
|
|
|
- pull_request
|
|
|
|
- name: build_image_and_push
|
|
|
|
image: gcr.io/kaniko-project/executor:v1.7.0-debug
|
2022-11-30 20:52:48 +00:00
|
|
|
environment:
|
|
|
|
CI_REGISTRY:
|
|
|
|
from_secret: registry_url
|
|
|
|
CI_REGISTRY_USER:
|
|
|
|
from_secret: registry_user
|
|
|
|
CI_REGISTRY_PASSWORD:
|
|
|
|
from_secret: registry_password
|
2022-11-28 21:19:27 +00:00
|
|
|
commands:
|
|
|
|
- echo "init registry credentials"
|
|
|
|
- echo $DRONE_WORKSPACE
|
|
|
|
- mkdir -p /kanico/.docker
|
|
|
|
- echo "{\"auths\":{\"$CI_REGISTRY\":{\"username\":\"$CI_REGISTRY_USER\",\"password\":\"$CI_REGISTRY_PASSWORD\"}}}" > /kaniko/.docker/config.json
|
|
|
|
- /kaniko/executor --context $DRONE_WORKSPACE --dockerfile Dockerfile --destination $CI_REGISTRY_IMAGE:$IMAGE_TAG
|
|
|
|
when:
|
|
|
|
branch:
|
|
|
|
- main
|
|
|
|
event:
|
|
|
|
- push
|