31 lines
866 B
YAML
31 lines
866 B
YAML
when:
|
|
- event: push
|
|
branch: main
|
|
|
|
depends_on:
|
|
- test
|
|
|
|
steps:
|
|
- name: build-image
|
|
image: gcr.io/kaniko-project/executor:v1.23.2-debug
|
|
environment:
|
|
GITEA_TOKEN:
|
|
from_secret: registry_token
|
|
commands:
|
|
- mkdir -p /kaniko/.docker
|
|
- REGISTRY=$${CI_FORGE_URL#*://}
|
|
- IMAGE="$$REGISTRY/$$CI_REPO"
|
|
- AUTH=$(printf "%s" "$CI_REPO_OWNER:$GITEA_TOKEN" | base64 -w0)
|
|
- printf '{"auths":{"%s":{"auth":"%s"}}}' "$$REGISTRY" "$AUTH" > /kaniko/.docker/config.json
|
|
- BUILD_TAG="build.$(date +%s)"
|
|
- >-
|
|
/kaniko/executor
|
|
--context=.
|
|
--dockerfile=Dockerfile
|
|
--destination=$$IMAGE:${CI_COMMIT_SHA}
|
|
--destination=$$IMAGE:${CI_COMMIT_SHA:0:7}
|
|
--destination=$$IMAGE:$${BUILD_TAG}
|
|
--destination=$$IMAGE:main
|
|
--snapshot-mode=redo
|
|
--use-new-run
|