From 499fdd6f56ba87b9a58c644d94c59936bab2a8f3 Mon Sep 17 00:00:00 2001 From: Sebastian Hugentobler Date: Mon, 14 Feb 2022 06:26:15 +0100 Subject: [PATCH] use kaniko to build container --- .gitlab-ci.yml | 24 +++++++++++-------- rootfs/bin/confd-env | 2 ++ rootfs/etc/s6-overlay/s6-rc.d/confd/up | 3 +-- .../s6-overlay/s6-rc.d/user/contents.d/confd | 0 4 files changed, 17 insertions(+), 12 deletions(-) create mode 100755 rootfs/bin/confd-env delete mode 100644 rootfs/etc/s6-overlay/s6-rc.d/user/contents.d/confd diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index f1568b5..af61f86 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -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" diff --git a/rootfs/bin/confd-env b/rootfs/bin/confd-env new file mode 100755 index 0000000..ed5c333 --- /dev/null +++ b/rootfs/bin/confd-env @@ -0,0 +1,2 @@ +#!/command/with-contenv sh +confd -onetime -backend env diff --git a/rootfs/etc/s6-overlay/s6-rc.d/confd/up b/rootfs/etc/s6-overlay/s6-rc.d/confd/up index ed5c333..74f92c5 100644 --- a/rootfs/etc/s6-overlay/s6-rc.d/confd/up +++ b/rootfs/etc/s6-overlay/s6-rc.d/confd/up @@ -1,2 +1 @@ -#!/command/with-contenv sh -confd -onetime -backend env +confd-env diff --git a/rootfs/etc/s6-overlay/s6-rc.d/user/contents.d/confd b/rootfs/etc/s6-overlay/s6-rc.d/user/contents.d/confd deleted file mode 100644 index e69de29..0000000