Loading .gitlab/ci/build.gitlab-ci.yml +17 −6 Original line number Diff line number Diff line Loading @@ -5,17 +5,28 @@ build: image: docker:20.10.5 services: - docker:20.10.5-dind variables: PLATFORMS: linux/amd64,linux/arm64 before_script: # install buildx - mkdir -p ~/.docker/cli-plugins - wget https://github.com/docker/buildx/releases/download/v0.6.1/buildx-v0.6.1.linux-amd64 -O ~/.docker/cli-plugins/docker-buildx - chmod a+x ~/.docker/cli-plugins/docker-buildx # See https://www.docker.com/blog/multi-platform-docker-builds/ - docker run --rm --privileged docker/binfmt:a7996909642ee92942dcd6cff44b9b95f08dad64 - docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" "$CI_REGISTRY" script: - export BUILD_IMAGE_LATEST="${CI_REGISTRY_IMAGE}/${CI_COMMIT_REF_SLUG}:latest" - docker buildx create --use - >- docker build docker buildx build --platform "$PLATFORMS" --build-arg "HELM_VERSION=$HELM_VERSION" --build-arg "KUBERNETES_VERSION=$KUBERNETES_VERSION" --build-arg "ALPINE_VERSION=$ALPINE_VERSION" --build-arg "GLIBC_VERSION=$GLIBC_VERSION" --tag "$BUILD_IMAGE_NAME" . - docker push "$BUILD_IMAGE_NAME" - export latest_tag="${CI_REGISTRY_IMAGE}/${CI_COMMIT_REF_SLUG}:latest" - docker tag "$BUILD_IMAGE_NAME" $latest_tag - docker push $latest_tag --tag "$BUILD_IMAGE_NAME" --tag "$BUILD_IMAGE_LATEST" --push . .gitlab/ci/release.gitlab-ci.yml +8 −11 Original line number Diff line number Diff line Loading @@ -10,22 +10,19 @@ release-tag: stage: release image: docker:20.10.5 services: - docker:20.10.5-dind image: name: gcr.io/go-containerregistry/crane:debug entrypoint: [""] script: - 'echo ${CI_JOB_TOKEN} | docker login --password-stdin -u $CI_REGISTRY_USER $CI_REGISTRY' # https://github.com/google/go-containerregistry/blob/main/cmd/crane/doc/crane_copy.md - crane auth login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" "$CI_REGISTRY" - export ci_image="${CI_REGISTRY_IMAGE}" - export ci_image_tag=${CI_COMMIT_TAG:-$CI_COMMIT_SHORT_SHA} - export ci_image_tag_major=$(echo $CI_COMMIT_TAG | sed 's/\(v[0-9]\+\)\.[0-9]\+\.[0-9]\+/\1/') - echo "Using tag $ci_image_tag for image" - docker pull "$BUILD_IMAGE_NAME" - docker tag "$BUILD_IMAGE_NAME" $ci_image:latest - docker tag "$BUILD_IMAGE_NAME" $ci_image:$ci_image_tag - docker tag "$BUILD_IMAGE_NAME" $ci_image:$ci_image_tag_major - docker push $ci_image:latest - docker push $ci_image:$ci_image_tag - docker push $ci_image:$ci_image_tag_major - crane cp "$BUILD_IMAGE_NAME" "${ci_image}:latest" - crane cp "$BUILD_IMAGE_NAME" "${ci_image}:${ci_image_tag}" - crane cp "$BUILD_IMAGE_NAME" "${ci_image}:${ci_image_tag_major}" rules: - if: $CI_COMMIT_TAG Loading Dockerfile +22 −7 Original line number Diff line number Diff line Loading @@ -7,13 +7,28 @@ FROM "registry.gitlab.com/gitlab-org/cluster-integration/helm-install-image/rele # https://github.com/sgerrand/alpine-pkg-glibc ARG GLIBC_VERSION # Install Dependencies RUN apk add --no-cache openssl curl tar gzip bash jq \ && curl -sSL -o /etc/apk/keys/sgerrand.rsa.pub https://alpine-pkgs.sgerrand.com/sgerrand.rsa.pub \ # Magic ARG provided by docker ARG TARGETARCH # Install shared dependencies RUN apk add --no-cache \ bash \ curl \ gzip \ jq \ openssl \ ruby \ ruby-json \ tar # Install legacy glibc dependency on amd64 RUN \ if [[ "$TARGETARCH" = "amd64" ]]; then \ curl -sSL -o /etc/apk/keys/sgerrand.rsa.pub https://alpine-pkgs.sgerrand.com/sgerrand.rsa.pub \ && curl -sSL -O https://github.com/sgerrand/alpine-pkg-glibc/releases/download/${GLIBC_VERSION}/glibc-${GLIBC_VERSION}.apk \ && apk add glibc-${GLIBC_VERSION}.apk \ && apk add ruby jq ruby-json \ && rm glibc-${GLIBC_VERSION}.apk && rm glibc-${GLIBC_VERSION}.apk; \ fi COPY src/ build/ COPY assets/ assets/ Loading Loading
.gitlab/ci/build.gitlab-ci.yml +17 −6 Original line number Diff line number Diff line Loading @@ -5,17 +5,28 @@ build: image: docker:20.10.5 services: - docker:20.10.5-dind variables: PLATFORMS: linux/amd64,linux/arm64 before_script: # install buildx - mkdir -p ~/.docker/cli-plugins - wget https://github.com/docker/buildx/releases/download/v0.6.1/buildx-v0.6.1.linux-amd64 -O ~/.docker/cli-plugins/docker-buildx - chmod a+x ~/.docker/cli-plugins/docker-buildx # See https://www.docker.com/blog/multi-platform-docker-builds/ - docker run --rm --privileged docker/binfmt:a7996909642ee92942dcd6cff44b9b95f08dad64 - docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" "$CI_REGISTRY" script: - export BUILD_IMAGE_LATEST="${CI_REGISTRY_IMAGE}/${CI_COMMIT_REF_SLUG}:latest" - docker buildx create --use - >- docker build docker buildx build --platform "$PLATFORMS" --build-arg "HELM_VERSION=$HELM_VERSION" --build-arg "KUBERNETES_VERSION=$KUBERNETES_VERSION" --build-arg "ALPINE_VERSION=$ALPINE_VERSION" --build-arg "GLIBC_VERSION=$GLIBC_VERSION" --tag "$BUILD_IMAGE_NAME" . - docker push "$BUILD_IMAGE_NAME" - export latest_tag="${CI_REGISTRY_IMAGE}/${CI_COMMIT_REF_SLUG}:latest" - docker tag "$BUILD_IMAGE_NAME" $latest_tag - docker push $latest_tag --tag "$BUILD_IMAGE_NAME" --tag "$BUILD_IMAGE_LATEST" --push .
.gitlab/ci/release.gitlab-ci.yml +8 −11 Original line number Diff line number Diff line Loading @@ -10,22 +10,19 @@ release-tag: stage: release image: docker:20.10.5 services: - docker:20.10.5-dind image: name: gcr.io/go-containerregistry/crane:debug entrypoint: [""] script: - 'echo ${CI_JOB_TOKEN} | docker login --password-stdin -u $CI_REGISTRY_USER $CI_REGISTRY' # https://github.com/google/go-containerregistry/blob/main/cmd/crane/doc/crane_copy.md - crane auth login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" "$CI_REGISTRY" - export ci_image="${CI_REGISTRY_IMAGE}" - export ci_image_tag=${CI_COMMIT_TAG:-$CI_COMMIT_SHORT_SHA} - export ci_image_tag_major=$(echo $CI_COMMIT_TAG | sed 's/\(v[0-9]\+\)\.[0-9]\+\.[0-9]\+/\1/') - echo "Using tag $ci_image_tag for image" - docker pull "$BUILD_IMAGE_NAME" - docker tag "$BUILD_IMAGE_NAME" $ci_image:latest - docker tag "$BUILD_IMAGE_NAME" $ci_image:$ci_image_tag - docker tag "$BUILD_IMAGE_NAME" $ci_image:$ci_image_tag_major - docker push $ci_image:latest - docker push $ci_image:$ci_image_tag - docker push $ci_image:$ci_image_tag_major - crane cp "$BUILD_IMAGE_NAME" "${ci_image}:latest" - crane cp "$BUILD_IMAGE_NAME" "${ci_image}:${ci_image_tag}" - crane cp "$BUILD_IMAGE_NAME" "${ci_image}:${ci_image_tag_major}" rules: - if: $CI_COMMIT_TAG Loading
Dockerfile +22 −7 Original line number Diff line number Diff line Loading @@ -7,13 +7,28 @@ FROM "registry.gitlab.com/gitlab-org/cluster-integration/helm-install-image/rele # https://github.com/sgerrand/alpine-pkg-glibc ARG GLIBC_VERSION # Install Dependencies RUN apk add --no-cache openssl curl tar gzip bash jq \ && curl -sSL -o /etc/apk/keys/sgerrand.rsa.pub https://alpine-pkgs.sgerrand.com/sgerrand.rsa.pub \ # Magic ARG provided by docker ARG TARGETARCH # Install shared dependencies RUN apk add --no-cache \ bash \ curl \ gzip \ jq \ openssl \ ruby \ ruby-json \ tar # Install legacy glibc dependency on amd64 RUN \ if [[ "$TARGETARCH" = "amd64" ]]; then \ curl -sSL -o /etc/apk/keys/sgerrand.rsa.pub https://alpine-pkgs.sgerrand.com/sgerrand.rsa.pub \ && curl -sSL -O https://github.com/sgerrand/alpine-pkg-glibc/releases/download/${GLIBC_VERSION}/glibc-${GLIBC_VERSION}.apk \ && apk add glibc-${GLIBC_VERSION}.apk \ && apk add ruby jq ruby-json \ && rm glibc-${GLIBC_VERSION}.apk && rm glibc-${GLIBC_VERSION}.apk; \ fi COPY src/ build/ COPY assets/ assets/ Loading