mirror of
https://github.com/GoogleContainerTools/kaniko
synced 2026-10-19 04:58:40 +02:00
Add multi-arch image via Bazel (#1452)
* Add multi-arch image via Bazel * Drop the commented tags * Move tests to //integration
This commit is contained in:
@@ -1,5 +1,8 @@
|
||||
# This cloudbuild is run on the creation of new tags, which should signify releases.
|
||||
timeout: 1800s
|
||||
|
||||
steps:
|
||||
|
||||
# First, build kaniko
|
||||
- name: "gcr.io/cloud-builders/docker"
|
||||
args: ["build", "-f", "deploy/Dockerfile",
|
||||
@@ -21,6 +24,73 @@ steps:
|
||||
- name: "gcr.io/cloud-builders/docker"
|
||||
args: ["tag", "gcr.io/kaniko-project/warmer:$TAG_NAME",
|
||||
"gcr.io/kaniko-project/warmer:latest"]
|
||||
|
||||
|
||||
# Build each of the multi-arch images with Bazel and load them into the Docker daemon.
|
||||
- name: gcr.io/cloud-marketplace-containers/google/bazel:3.4.1
|
||||
entrypoint: sh
|
||||
args:
|
||||
- -c
|
||||
- |
|
||||
#!/bin/sh
|
||||
set -o errexit
|
||||
set -o xtrace
|
||||
|
||||
bazel run //:gazelle
|
||||
bazel run --host_force_python=PY2 //cmd/executor:image_amd64
|
||||
bazel run --host_force_python=PY2 //cmd/executor:image_arm64
|
||||
|
||||
# Publish the individual container images
|
||||
- name: docker
|
||||
entrypoint: sh
|
||||
args:
|
||||
- -c
|
||||
- |
|
||||
#!/bin/sh
|
||||
set -o errexit
|
||||
set -o xtrace
|
||||
|
||||
docker tag bazel/cmd/executor:image_amd64 gcr.io/kaniko-project/executor:amd64
|
||||
docker tag bazel/cmd/executor:image_amd64 gcr.io/kaniko-project/executor:amd64-$TAG_NAME
|
||||
docker tag bazel/cmd/executor:image_arm64 gcr.io/kaniko-project/executor:arm64
|
||||
docker tag bazel/cmd/executor:image_arm64 gcr.io/kaniko-project/executor:arm64-$TAG_NAME
|
||||
|
||||
docker push gcr.io/kaniko-project/executor:amd64
|
||||
docker push gcr.io/kaniko-project/executor:amd64-$TAG_NAME
|
||||
docker push gcr.io/kaniko-project/executor:arm64
|
||||
docker push gcr.io/kaniko-project/executor:arm64-$TAG_NAME
|
||||
|
||||
# Enable "manifest list" support in docker, and publish one covering the per-architecture
|
||||
# images published above.
|
||||
- name: docker
|
||||
entrypoint: sh
|
||||
args:
|
||||
- -c
|
||||
- |
|
||||
#!/bin/sh
|
||||
set -o errexit
|
||||
set -o xtrace
|
||||
|
||||
# Publish manifest lists second, after all of the binary material
|
||||
# has been uploaded, so that it is fast. We want fast because enabling
|
||||
# the experimental features in docker changes ~/.docker/config.json, which
|
||||
# GCB periodically tramples.
|
||||
#
|
||||
# Enable support for 'docker manifest create'
|
||||
# https://docs.docker.com/engine/reference/commandline/manifest_create/
|
||||
sed -i 's/^{/{"experimental": "enabled",/g' ~/.docker/config.json
|
||||
|
||||
docker manifest create gcr.io/kaniko-project/executor:multi-arch \
|
||||
gcr.io/kaniko-project/executor:amd64 \
|
||||
gcr.io/kaniko-project/executor:arm64
|
||||
docker manifest push gcr.io/kaniko-project/executor:multi-arch
|
||||
|
||||
docker manifest create gcr.io/kaniko-project/executor:multi-arch-$TAG_NAME \
|
||||
gcr.io/kaniko-project/executor:amd64-$TAG_NAME \
|
||||
gcr.io/kaniko-project/executor:arm64-$TAG_NAME
|
||||
docker manifest push gcr.io/kaniko-project/executor:multi-arch-$TAG_NAME
|
||||
|
||||
|
||||
images: ["gcr.io/kaniko-project/executor:$TAG_NAME",
|
||||
"gcr.io/kaniko-project/executor:latest",
|
||||
"gcr.io/kaniko-project/executor:debug-$TAG_NAME",
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
timeout: 1800s
|
||||
|
||||
steps:
|
||||
|
||||
# First, build kaniko
|
||||
- name: "gcr.io/cloud-builders/docker"
|
||||
args: ["build", "-f", "deploy/Dockerfile",
|
||||
@@ -14,9 +17,68 @@ steps:
|
||||
- name: "gcr.io/cloud-builders/docker"
|
||||
args: ["build", "-f", "deploy/Dockerfile_warmer",
|
||||
"-t", "gcr.io/$PROJECT_ID/${_WARMER_IMAGE_NAME}:${COMMIT_SHA}", "."]
|
||||
|
||||
|
||||
# Build each of the multi-arch images with Bazel and load them into the Docker daemon.
|
||||
- name: gcr.io/cloud-marketplace-containers/google/bazel:3.4.1
|
||||
entrypoint: sh
|
||||
args:
|
||||
- -c
|
||||
- |
|
||||
#!/bin/sh
|
||||
set -o errexit
|
||||
set -o xtrace
|
||||
|
||||
bazel run //:gazelle
|
||||
bazel run --host_force_python=PY2 //cmd/executor:image_amd64
|
||||
bazel run --host_force_python=PY2 //cmd/executor:image_arm64
|
||||
|
||||
# Publish the individual container images
|
||||
- name: docker
|
||||
entrypoint: sh
|
||||
args:
|
||||
- -c
|
||||
- |
|
||||
#!/bin/sh
|
||||
set -o errexit
|
||||
set -o xtrace
|
||||
|
||||
docker tag bazel/cmd/executor:image_amd64 gcr.io/$PROJECT_ID/${_EXECUTOR_IMAGE_NAME}:amd64-${COMMIT_SHA}
|
||||
docker tag bazel/cmd/executor:image_arm64 gcr.io/$PROJECT_ID/${_EXECUTOR_IMAGE_NAME}:arm64-${COMMIT_SHA}
|
||||
|
||||
docker push gcr.io/$PROJECT_ID/${_EXECUTOR_IMAGE_NAME}:amd64-${COMMIT_SHA}
|
||||
docker push gcr.io/$PROJECT_ID/${_EXECUTOR_IMAGE_NAME}:arm64-${COMMIT_SHA}
|
||||
|
||||
# Enable "manifest list" support in docker, and publish one covering the per-architecture
|
||||
# images published above.
|
||||
- name: docker
|
||||
entrypoint: sh
|
||||
args:
|
||||
- -c
|
||||
- |
|
||||
#!/bin/sh
|
||||
set -o errexit
|
||||
set -o xtrace
|
||||
|
||||
# Publish manifest lists second, after all of the binary material
|
||||
# has been uploaded, so that it is fast. We want fast because enabling
|
||||
# the experimental features in docker changes ~/.docker/config.json, which
|
||||
# GCB periodically tramples.
|
||||
#
|
||||
# Enable support for 'docker manifest create'
|
||||
# https://docs.docker.com/engine/reference/commandline/manifest_create/
|
||||
sed -i 's/^{/{"experimental": "enabled",/g' ~/.docker/config.json
|
||||
|
||||
docker manifest create gcr.io/$PROJECT_ID/${_EXECUTOR_IMAGE_NAME}:multi-arch-${COMMIT_SHA} \
|
||||
gcr.io/$PROJECT_ID/${_EXECUTOR_IMAGE_NAME}:amd64-${COMMIT_SHA} \
|
||||
gcr.io/$PROJECT_ID/${_EXECUTOR_IMAGE_NAME}:arm64-${COMMIT_SHA}
|
||||
docker manifest push gcr.io/$PROJECT_ID/${_EXECUTOR_IMAGE_NAME}:multi-arch-${COMMIT_SHA}
|
||||
|
||||
|
||||
images: ["gcr.io/$PROJECT_ID/${_EXECUTOR_IMAGE_NAME}:${COMMIT_SHA}",
|
||||
"gcr.io/$PROJECT_ID/${_EXECUTOR_IMAGE_NAME}:debug-${COMMIT_SHA}",
|
||||
"gcr.io/$PROJECT_ID/${_WARMER_IMAGE_NAME}:${COMMIT_SHA}"]
|
||||
|
||||
substitutions:
|
||||
_EXECUTOR_IMAGE_NAME: executor
|
||||
_WARMER_IMAGE_NAME: warmer
|
||||
|
||||
Reference in New Issue
Block a user