File tree Expand file tree Collapse file tree 4 files changed +20
-54
lines changed
Expand file tree Collapse file tree 4 files changed +20
-54
lines changed Original file line number Diff line number Diff line change @@ -21,20 +21,22 @@ COPY cmd/ cmd/
2121COPY internal/ internal/
2222
2323# Build
24- # the GOARCH has not a default value to allow the binary be built according to the host where the command
25- # was called. For example, if we call make docker-build in a local env which has the Apple Silicon M1 SO
26- # the docker BUILDPLATFORM arg will be linux/arm64 when for Apple x86 it will be linux/amd64. Therefore,
27- # by leaving it empty we can ensure that the container and binary shipped on it will have the same platform.
28- RUN CGO_ENABLED=0 GOOS=${TARGETOS:-linux} GOARCH=${TARGETARCH} go build -a -o manager cmd/manager/main.go
24+ RUN CGO_ENABLED=0 GOOS=${TARGETOS:-linux} GOARCH=${TARGETARCH} go build -o /workspace ./...
2925
3026# ###############################################################################
3127
32- # Use distroless as minimal base image to package the manager binary
33- # Refer to https://github.com/GoogleContainerTools/distroless for more details
34- FROM gcr.io/distroless/static:nonroot
35-
28+ # Ref: https://github.com/GoogleContainerTools/distroless
29+ FROM gcr.io/distroless/static:nonroot AS manager
3630WORKDIR /
3731COPY --from=builder /workspace/manager .
3832USER 65532:65532
39-
4033ENTRYPOINT ["/manager" ]
34+
35+ # ###############################################################################
36+
37+ # Ref: https://github.com/GoogleContainerTools/distroless
38+ FROM gcr.io/distroless/static:nonroot AS webhook
39+ WORKDIR /
40+ COPY --from=builder /workspace/webhook .
41+ USER 65532:65532
42+ ENTRYPOINT ["/webhook" ]
Load Diff This file was deleted.
Original file line number Diff line number Diff line change @@ -47,7 +47,8 @@ group "default" {
4747
4848target "operator" {
4949 inherits = [" _common" ]
50- dockerfile = " build/Dockerfile.operator"
50+ dockerfile = " Dockerfile"
51+ target = " manager"
5152 labels = {
5253 # Ref: https://github.com/opencontainers/image-spec/blob/v1.0/annotations.md
5354 " org.opencontainers.image.title" = " Slurm Operator"
@@ -66,7 +67,8 @@ target "operator" {
6667
6768target "webhook" {
6869 inherits = [" _common" ]
69- dockerfile = " build/Dockerfile.webhook"
70+ dockerfile = " Dockerfile"
71+ target = " webhook"
7072 labels = {
7173 # Ref: https://github.com/opencontainers/image-spec/blob/v1.0/annotations.md
7274 " org.opencontainers.image.title" = " Slurm Operator Webhook"
Original file line number Diff line number Diff line change @@ -12,11 +12,13 @@ profiles:
1212 - image : slinky.slurm.net/slurm-operator
1313 context : ../../
1414 docker :
15- dockerfile : ./build/Dockerfile.operator
15+ dockerfile : Dockerfile
16+ target : manager
1617 - image : slinky.slurm.net/slurm-operator-webhook
1718 context : ../../
1819 docker :
19- dockerfile : ./build/Dockerfile.webhook
20+ dockerfile : Dockerfile
21+ target : webhook
2022 deploy :
2123 helm :
2224 releases :
You can’t perform that action at this time.
0 commit comments