use kaniko to build container

This commit is contained in:
Sebastian Hugentobler 2022-02-14 06:26:15 +01:00
parent 0f8278d430
commit 499fdd6f56
Signed by: shu
GPG Key ID: BB32CF3CA052C2F0
4 changed files with 17 additions and 12 deletions

View File

@ -1,18 +1,22 @@
stages:
- build
- trigger
variables:
IMAGE_NAME: thallian/confd-env
CI_BUILD_ARCHS: "linux/amd64,linux/arm64"
DOWNSTREAM_PROJECTS: " 19 20 21 25 27 28 29 30 31 32 34 35 36 37 39 40 41 42 43 44 47 48 74 88 98 109 112 120"
CI_REGISTRY_IMAGE: thallian/confd-env
DOWNSTREAM_PROJECTS: ""
build:
stage: build
image:
name: gcr.io/kaniko-project/executor:debug
entrypoint: [""]
script:
- docker login -u $DOCKER_USER -p $DOCKER_PASSWORD $DOCKER_REGISTRY
- docker buildx build --platform "$CI_BUILD_ARCHS" --progress plain --pull --tag "$IMAGE_NAME:$CI_COMMIT_SHA" --tag "$IMAGE_NAME:$CI_COMMIT_REF_NAME" --tag "$IMAGE_NAME:latest" --push .
- |
for proj in $DOWNSTREAM_PROJECTS; do
curl --request POST --form "token=$CI_JOB_TOKEN" --form ref=master $CI_API_V4_URL/projects/$proj/trigger/pipeline
done
- mkdir -p /kaniko/.docker
- echo "{\"auths\":{\"$CI_REGISTRY\":{\"auth\":\"$(printf "%s:%s" "$CI_REGISTRY_USER" "$CI_REGISTRY_PASSWORD" | base64 | tr -d '\n')\"}}}" > /kaniko/.docker/config.json
- >-
/kaniko/executor
--context "$CI_PROJECT_DIR"
--dockerfile "$CI_PROJECT_DIR/Dockerfile"
--destination "$CI_REGISTRY_IMAGE:$CI_COMMIT_SHA"
--destination "$CI_REGISTRY_IMAGE:$CI_COMMIT_REF_NAME"
--destination "$CI_REGISTRY_IMAGE:latest"

2
rootfs/bin/confd-env Executable file
View File

@ -0,0 +1,2 @@
#!/command/with-contenv sh
confd -onetime -backend env

View File

@ -1,2 +1 @@
#!/command/with-contenv sh
confd -onetime -backend env
confd-env