Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(images): add multi-platform images for garden deployed services #6072

Merged
merged 1 commit into from
May 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion images/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,13 @@

Here we place container images that we maintain and reference when using Garden.

To build, just use `garden build`, and to publish, `garden publish`.
We are building all images except the circleci image multi-platform for linux/arm64 and linux/amd64. To setup building multi-platform with buildx locally check instructions for:

* Docker Desktop: https://docs.docker.com/build/building/multi-platform/#building-multi-platform-images
* Orbstack: https://docs.orbstack.dev/docker/images#multiplatform

Please note that the images are not available in your local docker images store, because they are build in the docker-container buildx builder. They are always pushed to DockerHub. If you want to inspect and run them locally pull them down.

To build and push to DockerHub with a tag `dev` use `garden build`, and to publish a new image with a version tag specified in the `release_tag` variable run `garden build --var publish=true`.

This is an intermediate step to allow multi platform builds and publish them to DockerHub until multi-platform builds are integrated more natively into garden and work with the publish command.
38 changes: 23 additions & 15 deletions images/buildkit/garden.yml
Original file line number Diff line number Diff line change
@@ -1,23 +1,31 @@
kind: Module
kind: Build
type: container
name: buildkit
description: Used for the cluster-buildkit build mode in the kubernetes provider
image: gardendev/buildkit:v0.12.2-1
dockerfile: Dockerfile
build:
targetImage: buildkit
extraFlags: [ "--platform", "linux/amd64" ]

variables:
publish: false
image_name: gardendev/buildkit
image_tag: "${var.publish ? var.release_tag : 'dev'}"
release_tag: v0.12.2-2
spec:
localId: ${var.image_name}
dockerfile: Dockerfile
extraFlags: [ "--platform", "linux/amd64,linux/arm64", "--tag", "${var.image_name}:${var.image_tag}", "--push" ]
---

kind: Module
kind: Build
type: container
name: buildkit-rootless
description: Used for the cluster-buildkit build mode in the kubernetes provider, rootless variant
image: gardendev/buildkit:v0.12.2-1-rootless
dockerfile: Dockerfile
build:
dependencies:
- buildkit
targetImage: buildkit-rootless
extraFlags: [ "--platform", "linux/amd64" ]
dependencies:
- build.buildkit
variables:
publish: false
image_name: gardendev/buildkit
image_tag: "${var.publish ? var.release_tag : 'dev'}"
release_tag: v0.12.2-2-rootless
spec:
localId: ${var.image_name}
dockerfile: Dockerfile
targetStage: buildkit-rootless
extraFlags: [ "--platform", "linux/amd64,linux/arm64", "--tag", "${var.image_name}:${var.image_tag}", "--push" ]
12 changes: 9 additions & 3 deletions images/circleci-runner/garden.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
kind: Module
kind: Build
type: container
name: circleci-runner
description: Used for the core pipeline in CircleCI
image: gardendev/circleci-runner:22.1.0-1
extraFlags: ["--platform", "linux/amd64"]
variables:
publish: false
image_name: gardendev/circleci-runner
image_tag: "${var.publish ? var.release_tag : 'dev'}"
release_tag: 22.1.0-2
spec:
localId: gardendev/circleci-runner
extraFlags: [ "--platform", "linux/amd64", "--tag", "${var.image_name}:${var.image_tag}", "--push" ]
14 changes: 10 additions & 4 deletions images/k8s-reverse-proxy/garden.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
kind: Module
kind: Build
type: container
name: k8s-reverse-proxy
description: Used in local deployment mode as a reversed proxy in k8s cluster to replace an actual service and to route its traffic to a local service.
image: gardendev/k8s-reverse-proxy:0.1.0
dockerfile: Dockerfile
extraFlags: [ "--platform", "linux/amd64" ]
variables:
publish: false
image_name: gardendev/k8s-reverse-proxy
image_tag: "${var.publish ? var.release_tag : 'dev'}"
release_tag: 0.1.1
spec:
localId: ${var.image_name}
dockerfile: Dockerfile
extraFlags: [ "--platform", "linux/amd64,linux/arm64", "--tag", "${var.image_name}:${var.image_tag}", "--push" ]
14 changes: 10 additions & 4 deletions images/k8s-sync/garden.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
kind: Module
kind: Build
type: container
name: k8s-sync
description: Used by the kubernetes provider for sync setup
image: gardendev/k8s-sync:0.2.0 # Starting from version 0.2.0 Garden uses original Mutagen binaries instead of own fork.
dockerfile: Dockerfile
extraFlags: [ "--platform", "linux/amd64" ]
variables:
publish: false
image_name: gardendev/k8s-sync
image_tag: "${var.publish ? var.release_tag : 'dev'}"
release_tag: 0.2.0-1 # Starting from version 0.2.0 Garden uses original Mutagen binaries instead of own fork.
spec:
localId: ${var.image_name}
dockerfile: Dockerfile
extraFlags: [ "--platform", "linux/amd64,linux/arm64", "--tag", "${var.image_name}:${var.image_tag}", "--push" ]
21 changes: 13 additions & 8 deletions images/k8s-util/garden.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,16 @@
kind: Module
kind: Build
type: container
name: k8s-util
description: Used by the kubernetes provider for build-related activities
image: gardendev/k8s-util:0.6.0 # Starting from version 0.6.0 k8s-util uses k8s-sync 0.2.x.
dockerfile: Dockerfile
build:
dependencies: [k8s-sync]
buildArgs:
BASE_IMAGE: ${modules.k8s-sync.outputs.local-image-id}
extraFlags: [ "--platform", "linux/amd64" ]
dependencies: [build.k8s-sync]
variables:
publish: false
image_name: gardendev/k8s-util
image_tag: "${var.publish ? var.release_tag : 'dev'}"
release_tag: 0.6.0-1 # Starting from version 0.6.0 k8s-util uses k8s-sync 0.2.x.
spec:
localId: ${var.image_name}
dockerfile: Dockerfile
buildArgs:
BASE_IMAGE: ${actions.build.k8s-sync.var.image_name}:${actions.build.k8s-sync.var.image_tag}
extraFlags: [ "--platform", "linux/amd64,linux/arm64", "--tag", "${var.image_name}:${var.image_tag}", "--push" ]
14 changes: 10 additions & 4 deletions images/skopeo/garden.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
kind: Module
kind: Build
type: container
name: skopeo
description: Used by the kubernetes provider for interacting with container registries within a cluster
image: gardendev/skopeo:1.41.0-4
dockerfile: Dockerfile
extraFlags: [ "--platform", "linux/amd64" ]
variables:
publish: false
image_name: gardendev/skopeo
image_tag: "${var.publish ? var.release_tag : 'dev'}"
release_tag: 1.41.0-5
spec:
localId: ${var.image_name}
dockerfile: Dockerfile
extraFlags: [ "--platform", "linux/amd64,linux/arm64", "--tag", "${var.image_name}:${var.image_tag}", "--push" ]