Skip to content

Commit 63ad4e7

Browse files
chore: use docker bake to manage images
1 parent 90d294d commit 63ad4e7

File tree

5 files changed

+86
-44
lines changed

5 files changed

+86
-44
lines changed

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,12 +65,12 @@ REGISTRY ?= slinky.slurm.net
6565

6666
.PHONY: build
6767
build: ## Build container images.
68-
$(foreach dockerfile, $(wildcard ./build/**/Dockerfile), $(MAKE) docker-build IMG="$(REGISTRY)/$(shell basename "$(shell dirname "${dockerfile}")"):$(VERSION)" DOCKERFILE_PATH="${dockerfile}" ;)
68+
REGISTRY=$(REGISTRY) VERSION=$(VERSION) docker buildx bake
6969
$(foreach chart, $(wildcard ./helm/**/Chart.yaml), helm package --dependency-update helm/$(shell basename "$(shell dirname "${chart}")") ;)
7070

7171
.PHONY: push
7272
push: build ## Push container images.
73-
$(foreach dockerfile, $(wildcard ./build/**/Dockerfile), $(MAKE) docker-push IMG="$(REGISTRY)/$(shell basename "$(shell dirname "${dockerfile}")"):$(VERSION)" DOCKERFILE_PATH="${dockerfile}" ;)
73+
REGISTRY=$(REGISTRY) VERSION=$(VERSION) docker buildx bake --push
7474
$(foreach chart, $(wildcard ./*.tgz), helm push ${chart} oci://$(REGISTRY)/charts ;)
7575

7676
.PHONY: clean
Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -33,26 +33,6 @@ RUN CGO_ENABLED=0 GOOS=${TARGETOS:-linux} GOARCH=${TARGETARCH} go build -a -o ma
3333
# Refer to https://github.com/GoogleContainerTools/distroless for more details
3434
FROM gcr.io/distroless/static:nonroot
3535

36-
# OCI Annotations
37-
# https://github.com/opencontainers/image-spec/blob/v1.0/annotations.md
38-
LABEL org.opencontainers.image.authors="[email protected]" \
39-
org.opencontainers.image.title="Slurm Operator" \
40-
org.opencontainers.image.description="Kubernetes Operator for Slurm" \
41-
org.opencontainers.image.documentation="https://github.com/SlinkyProject/slurm-operator" \
42-
org.opencontainers.image.license="Apache-2.0" \
43-
org.opencontainers.image.vendor="SchedMD LLC." \
44-
org.opencontainers.image.version="v0.2.0" \
45-
org.opencontainers.image.source="https://github.com/SlinkyProject/slurm-operator"
46-
47-
# HasRequiredLabel requirement from Red Hat OpenShift Software Certification
48-
# https://access.redhat.com/documentation/en-us/red_hat_software_certification/2024/html/red_hat_openshift_software_certification_policy_guide/assembly-requirements-for-container-images_openshift-sw-cert-policy-introduction#con-image-metadata-requirements_openshift-sw-cert-policy-container-images
49-
LABEL name="Slurm Operator" \
50-
summary="Kubernetes Operator for Slurm " \
51-
description="Kubernetes Operator for Slurm" \
52-
vendor="SchedMD LLC." \
53-
version="v0.2.0" \
54-
release="https://github.com/SlinkyProject/slurm-operator"
55-
5636
WORKDIR /
5737
COPY --from=builder /workspace/manager .
5838
USER 65532:65532
Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -33,26 +33,6 @@ RUN CGO_ENABLED=0 GOOS=${TARGETOS:-linux} GOARCH=${TARGETARCH} go build -a -o we
3333
# Refer to https://github.com/GoogleContainerTools/distroless for more details
3434
FROM gcr.io/distroless/static:nonroot
3535

36-
# OCI Annotations
37-
# https://github.com/opencontainers/image-spec/blob/v1.0/annotations.md
38-
LABEL org.opencontainers.image.authors="[email protected]" \
39-
org.opencontainers.image.title="Slurm Operator Webhook" \
40-
org.opencontainers.image.description="Kubernetes Operator Webhook for Slurm" \
41-
org.opencontainers.image.documentation="https://github.com/SlinkyProject/slurm-operator" \
42-
org.opencontainers.image.license="Apache-2.0" \
43-
org.opencontainers.image.vendor="SchedMD LLC." \
44-
org.opencontainers.image.version="v0.2.0" \
45-
org.opencontainers.image.source="https://github.com/SlinkyProject/slurm-operator"
46-
47-
# HasRequiredLabel requirement from Red Hat OpenShift Software Certification
48-
# https://access.redhat.com/documentation/en-us/red_hat_software_certification/2024/html/red_hat_openshift_software_certification_policy_guide/assembly-requirements-for-container-images_openshift-sw-cert-policy-introduction#con-image-metadata-requirements_openshift-sw-cert-policy-container-images
49-
LABEL name="Slurm Operator Webhook" \
50-
summary="Kubernetes Operator Webhook for Slurm " \
51-
description="Kubernetes Operator Webhook for Slurm" \
52-
vendor="SchedMD LLC." \
53-
version="v0.2.0" \
54-
release="https://github.com/SlinkyProject/slurm-operator"
55-
5636
WORKDIR /
5737
COPY --from=builder /workspace/webhook .
5838
USER 65532:65532

docker-bake.hcl

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
// SPDX-FileCopyrightText: Copyright (C) SchedMD LLC.
2+
// SPDX-License-Identifier: Apache-2.0
3+
4+
################################################################################
5+
6+
variable "REGISTRY" {
7+
default = "ghcr.io/slinkyproject"
8+
}
9+
10+
variable "VERSION" {
11+
default = "0.0.0"
12+
}
13+
14+
function "format_tag" {
15+
params = [registry, stage, version]
16+
result = format("%s:%s", join("/", compact([registry, stage])), join("-", compact([version])))
17+
}
18+
19+
################################################################################
20+
21+
target "_common" {
22+
labels = {
23+
# Ref: https://github.com/opencontainers/image-spec/blob/v1.0/annotations.md
24+
"org.opencontainers.image.authors" = "[email protected]"
25+
"org.opencontainers.image.documentation" = "https://github.com/SlinkyProject/slurm-operator"
26+
"org.opencontainers.image.license" = "Apache-2.0"
27+
"org.opencontainers.image.vendor" = "SchedMD LLC."
28+
"org.opencontainers.image.version" = "${VERSION}"
29+
"org.opencontainers.image.source" = "https://github.com/SlinkyProject/slurm-operator"
30+
# Ref: https://docs.redhat.com/en/documentation/red_hat_software_certification/2025/html/red_hat_openshift_software_certification_policy_guide/assembly-requirements-for-container-images_openshift-sw-cert-policy-introduction#con-image-metadata-requirements_openshift-sw-cert-policy-container-images
31+
"vendor" = "SchedMD LLC."
32+
"version" = "${VERSION}"
33+
"release" = "https://github.com/SlinkyProject/slurm-operator"
34+
}
35+
}
36+
37+
################################################################################
38+
39+
group "default" {
40+
targets = [
41+
"operator",
42+
"webhook",
43+
]
44+
}
45+
46+
################################################################################
47+
48+
target "operator" {
49+
inherits = ["_common"]
50+
dockerfile = "build/Dockerfile.operator"
51+
labels = {
52+
# Ref: https://github.com/opencontainers/image-spec/blob/v1.0/annotations.md
53+
"org.opencontainers.image.title" = "Slurm Operator"
54+
"org.opencontainers.image.description" = "Kubernetes Operator for Slurm"
55+
# Ref: https://docs.redhat.com/en/documentation/red_hat_software_certification/2025/html/red_hat_openshift_software_certification_policy_guide/assembly-requirements-for-container-images_openshift-sw-cert-policy-introduction#con-image-metadata-requirements_openshift-sw-cert-policy-container-images
56+
"name" = "Slurm Operator"
57+
"summary" = "Kubernetes Operator for Slurm"
58+
"description" = "Kubernetes Operator for Slurm"
59+
}
60+
tags = [
61+
format_tag("${REGISTRY}", "slurm-operator", "${VERSION}"),
62+
]
63+
}
64+
65+
################################################################################
66+
67+
target "webhook" {
68+
inherits = ["_common"]
69+
dockerfile = "build/Dockerfile.webhook"
70+
labels = {
71+
# Ref: https://github.com/opencontainers/image-spec/blob/v1.0/annotations.md
72+
"org.opencontainers.image.title" = "Slurm Operator Webhook"
73+
"org.opencontainers.image.description" = "Kubernetes Operator Webhook for Slurm"
74+
# Ref: https://docs.redhat.com/en/documentation/red_hat_software_certification/2025/html/red_hat_openshift_software_certification_policy_guide/assembly-requirements-for-container-images_openshift-sw-cert-policy-introduction#con-image-metadata-requirements_openshift-sw-cert-policy-container-images
75+
"name" = "Slurm Operator Webhook"
76+
"summary" = "Kubernetes Operator Webhook for Slurm"
77+
"description" = "Kubernetes Operator Webhook for Slurm"
78+
}
79+
tags = [
80+
format_tag("${REGISTRY}", "slurm-operator-webhook", "${VERSION}"),
81+
]
82+
}

helm/slurm-operator/skaffold.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,11 @@ profiles:
1212
- image: slinky.slurm.net/slurm-operator
1313
context: ../../
1414
docker:
15-
dockerfile: ./build/slurm-operator/Dockerfile
15+
dockerfile: ./build/Dockerfile.operator
1616
- image: slinky.slurm.net/slurm-operator-webhook
1717
context: ../../
1818
docker:
19-
dockerfile: ./build/slurm-operator-webhook/Dockerfile
19+
dockerfile: ./build/Dockerfile.webhook
2020
deploy:
2121
helm:
2222
releases:

0 commit comments

Comments
 (0)