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

Fix Dockerfile linting issues #1170

Merged
Merged
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
46 changes: 23 additions & 23 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Build the manager binary
FROM --platform=$BUILDPLATFORM golang:1.23 as builder
FROM --platform=$BUILDPLATFORM golang:1.23 AS builder

WORKDIR /workspace
# Copy the Go Modules manifests
Expand Down Expand Up @@ -28,105 +28,105 @@ ARG TARGETARCH

RUN mkdir bin

FROM builder as apiserver-builder
FROM builder AS apiserver-builder

RUN --mount=type=cache,target=/root/.cache/go-build \
--mount=type=cache,target=/go/pkg \
CGO_ENABLED=0 GOOS=$TARGETOS GOARCH=$TARGETARCH GO111MODULE=on go build -ldflags="-s -w" -a -o bin/ironcore-apiserver ./cmd/ironcore-apiserver

FROM builder as manager-builder
FROM builder AS manager-builder

RUN --mount=type=cache,target=/root/.cache/go-build \
--mount=type=cache,target=/go/pkg \
CGO_ENABLED=0 GOOS=$TARGETOS GOARCH=$TARGETARCH GO111MODULE=on go build -ldflags="-s -w" -a -o bin/ironcore-controller-manager ./cmd/ironcore-controller-manager

FROM builder as machinepoollet-builder
FROM builder AS machinepoollet-builder

RUN --mount=type=cache,target=/root/.cache/go-build \
--mount=type=cache,target=/go/pkg \
CGO_ENABLED=0 GOOS=$TARGETOS GOARCH=$TARGETARCH GO111MODULE=on go build -ldflags="-s -w" -a -o bin/machinepoollet ./poollet/machinepoollet/cmd/machinepoollet/main.go

FROM builder as machinebroker-builder
FROM builder AS machinebroker-builder

# TODO: Remove irictl-machine once debug containers are more broadly available.
RUN --mount=type=cache,target=/root/.cache/go-build \
--mount=type=cache,target=/go/pkg \
CGO_ENABLED=0 GOOS=$TARGETOS GOARCH=$TARGETARCH GO111MODULE=on go build -ldflags="-s -w" -a -o bin/machinebroker ./broker/machinebroker/cmd/machinebroker/main.go && \
CGO_ENABLED=0 GOOS=$TARGETOS GOARCH=$TARGETARCH GO111MODULE=on go build -ldflags="-s -w" -a -o bin/irictl-machine ./irictl-machine/cmd/irictl-machine/main.go

FROM builder as irictl-machine-builder
FROM builder AS irictl-machine-builder

RUN --mount=type=cache,target=/root/.cache/go-build \
--mount=type=cache,target=/go/pkg \
CGO_ENABLED=0 GOOS=$TARGETOS GOARCH=$TARGETARCH GO111MODULE=on go build -ldflags="-s -w" -a -o bin/irictl-machine ./irictl-machine/cmd/irictl-machine/main.go

FROM builder as volumepoollet-builder
FROM builder AS volumepoollet-builder

RUN --mount=type=cache,target=/root/.cache/go-build \
--mount=type=cache,target=/go/pkg \
CGO_ENABLED=0 GOOS=$TARGETOS GOARCH=$TARGETARCH GO111MODULE=on go build -ldflags="-s -w" -a -o bin/volumepoollet ./poollet/volumepoollet/cmd/volumepoollet/main.go


FROM builder as volumebroker-builder
FROM builder AS volumebroker-builder

# TODO: Remove irictl-volume once debug containers are more broadly available.
RUN --mount=type=cache,target=/root/.cache/go-build \
--mount=type=cache,target=/go/pkg \
CGO_ENABLED=0 GOOS=$TARGETOS GOARCH=$TARGETARCH GO111MODULE=on go build -ldflags="-s -w" -a -o bin/volumebroker ./broker/volumebroker/cmd/volumebroker/main.go && \
CGO_ENABLED=0 GOOS=$TARGETOS GOARCH=$TARGETARCH GO111MODULE=on go build -ldflags="-s -w" -a -o bin/irictl-volume ./irictl-volume/cmd/irictl-volume/main.go

FROM builder as irictl-volume-builder
FROM builder AS irictl-volume-builder

RUN --mount=type=cache,target=/root/.cache/go-build \
--mount=type=cache,target=/go/pkg \
CGO_ENABLED=0 GOOS=$TARGETOS GOARCH=$TARGETARCH GO111MODULE=on go build -ldflags="-s -w" -a -o bin/irictl-volume ./irictl-volume/cmd/irictl-volume/main.go

FROM builder as bucketpoollet-builder
FROM builder AS bucketpoollet-builder

RUN --mount=type=cache,target=/root/.cache/go-build \
--mount=type=cache,target=/go/pkg \
CGO_ENABLED=0 GOOS=$TARGETOS GOARCH=$TARGETARCH GO111MODULE=on go build -ldflags="-s -w" -a -o bin/bucketpoollet ./poollet/bucketpoollet/cmd/bucketpoollet/main.go


FROM builder as bucketbroker-builder
FROM builder AS bucketbroker-builder

# TODO: Remove irictl-bucket once debug containers are more broadly available.
RUN --mount=type=cache,target=/root/.cache/go-build \
--mount=type=cache,target=/go/pkg \
CGO_ENABLED=0 GOOS=$TARGETOS GOARCH=$TARGETARCH GO111MODULE=on go build -ldflags="-s -w" -a -o bin/bucketbroker ./broker/bucketbroker/cmd/bucketbroker/main.go && \
CGO_ENABLED=0 GOOS=$TARGETOS GOARCH=$TARGETARCH GO111MODULE=on go build -ldflags="-s -w" -a -o bin/irictl-bucket ./irictl-bucket/cmd/irictl-bucket/main.go

FROM builder as irictl-bucket-builder
FROM builder AS irictl-bucket-builder

RUN --mount=type=cache,target=/root/.cache/go-build \
--mount=type=cache,target=/go/pkg \
CGO_ENABLED=0 GOOS=$TARGETOS GOARCH=$TARGETARCH GO111MODULE=on go build -ldflags="-s -w" -a -o bin/irictl-bucket ./irictl-bucket/cmd/irictl-bucket/main.go

# Use distroless as minimal base image to package the manager binary
# Refer to https://github.com/GoogleContainerTools/distroless for more details
FROM gcr.io/distroless/static:nonroot as manager
FROM gcr.io/distroless/static:nonroot AS manager
WORKDIR /
COPY --from=manager-builder /workspace/bin/ironcore-controller-manager .
USER 65532:65532

ENTRYPOINT ["/ironcore-controller-manager"]

FROM gcr.io/distroless/static:nonroot as apiserver
FROM gcr.io/distroless/static:nonroot AS apiserver
WORKDIR /
COPY --from=apiserver-builder /workspace/bin/ironcore-apiserver .
USER 65532:65532

ENTRYPOINT ["/ironcore-apiserver"]

FROM gcr.io/distroless/static:nonroot as machinepoollet
FROM gcr.io/distroless/static:nonroot AS machinepoollet
WORKDIR /
COPY --from=machinepoollet-builder /workspace/bin/machinepoollet .
USER 65532:65532

ENTRYPOINT ["/machinepoollet"]

# TODO: Switch to distroless as soon as ephemeral debug containers are more broadly available.
FROM debian:bullseye-slim as machinebroker
FROM debian:bullseye-slim AS machinebroker
WORKDIR /
COPY --from=machinebroker-builder /workspace/bin/machinebroker .
# TODO: Remove irictl-machine as soon as ephemeral debug containers are more broadly available.
Expand All @@ -135,20 +135,20 @@ USER 65532:65532

ENTRYPOINT ["/machinebroker"]

FROM debian:bullseye-slim as irictl-machine
FROM debian:bullseye-slim AS irictl-machine
WORKDIR /
COPY --from=irictl-machine-builder /workspace/bin/irictl-machine .
USER 65532:65532

FROM gcr.io/distroless/static:nonroot as volumepoollet
FROM gcr.io/distroless/static:nonroot AS volumepoollet
WORKDIR /
COPY --from=volumepoollet-builder /workspace/bin/volumepoollet .
USER 65532:65532

ENTRYPOINT ["/volumepoollet"]

# TODO: Switch to distroless as soon as ephemeral debug containers are more broadly available.
FROM debian:bullseye-slim as volumebroker
FROM debian:bullseye-slim AS volumebroker
WORKDIR /
COPY --from=volumebroker-builder /workspace/bin/volumebroker .
# TODO: Remove irictl-volume as soon as ephemeral debug containers are more broadly available.
Expand All @@ -157,20 +157,20 @@ USER 65532:65532

ENTRYPOINT ["/volumebroker"]

FROM debian:bullseye-slim as irictl-volume
FROM debian:bullseye-slim AS irictl-volume
WORKDIR /
COPY --from=irictl-volume-builder /workspace/bin/irictl-volume .
USER 65532:65532

FROM gcr.io/distroless/static:nonroot as bucketpoollet
FROM gcr.io/distroless/static:nonroot AS bucketpoollet
WORKDIR /
COPY --from=bucketpoollet-builder /workspace/bin/bucketpoollet .
USER 65532:65532

ENTRYPOINT ["/bucketpoollet"]

# TODO: Switch to distroless as soon as ephemeral debug containers are more broadly available.
FROM debian:bullseye-slim as bucketbroker
FROM debian:bullseye-slim AS bucketbroker
WORKDIR /
COPY --from=bucketbroker-builder /workspace/bin/bucketbroker .
# TODO: Remove irictl-bucket as soon as ephemeral debug containers are more broadly available.
Expand All @@ -179,7 +179,7 @@ USER 65532:65532

ENTRYPOINT ["/bucketbroker"]

FROM debian:bullseye-slim as irictl-bucket
FROM debian:bullseye-slim AS irictl-bucket
WORKDIR /
COPY --from=irictl-bucket-builder /workspace/bin/irictl-bucket .
USER 65532:65532