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: stages:
- build - build
- trigger
variables: variables:
IMAGE_NAME: thallian/confd-env CI_REGISTRY_IMAGE: thallian/confd-env
CI_BUILD_ARCHS: "linux/amd64,linux/arm64" DOWNSTREAM_PROJECTS: ""
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"
build: build:
stage: build stage: build
image:
name: gcr.io/kaniko-project/executor:debug
entrypoint: [""]
script: script:
- docker login -u $DOCKER_USER -p $DOCKER_PASSWORD $DOCKER_REGISTRY - mkdir -p /kaniko/.docker
- 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 . - echo "{\"auths\":{\"$CI_REGISTRY\":{\"auth\":\"$(printf "%s:%s" "$CI_REGISTRY_USER" "$CI_REGISTRY_PASSWORD" | base64 | tr -d '\n')\"}}}" > /kaniko/.docker/config.json
- | - >-
for proj in $DOWNSTREAM_PROJECTS; do /kaniko/executor
curl --request POST --form "token=$CI_JOB_TOKEN" --form ref=master $CI_API_V4_URL/projects/$proj/trigger/pipeline --context "$CI_PROJECT_DIR"
done --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-env
confd -onetime -backend env