From 09551d0cee32ba74d2d6b9e1f8f7364ed3103159 Mon Sep 17 00:00:00 2001 From: Eno Compton Date: Fri, 8 Dec 2023 10:24:08 -0700 Subject: [PATCH] fix: label container images correctly Fixes #2060 --- Dockerfile | 5 +++-- Dockerfile.alpine | 5 +++-- Dockerfile.bullseye | 5 +++-- Dockerfile.buster | 5 +++-- 4 files changed, 12 insertions(+), 8 deletions(-) diff --git a/Dockerfile b/Dockerfile index a26932851..08e82538d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -15,8 +15,6 @@ # Use the latest stable golang 1.x to compile to a binary FROM --platform=$BUILDPLATFORM golang:1 as build -LABEL org.opencontainers.image.source="https://github.com/GoogleCloudPlatform/cloud-sql-proxy" - WORKDIR /go/src/cloud-sql-proxy COPY . . @@ -29,6 +27,9 @@ RUN CGO_ENABLED=0 GOOS=${TARGETOS} GOARCH=${TARGETARCH} \ # Final Stage FROM gcr.io/distroless/static:nonroot@sha256:91ca4720011393f4d4cab3a01fa5814ee2714b7d40e6c74f2505f74168398ca9 + +LABEL org.opencontainers.image.source="https://github.com/GoogleCloudPlatform/cloud-sql-proxy" + COPY --from=build --chown=nonroot /go/src/cloud-sql-proxy/cloud-sql-proxy /cloud-sql-proxy # set the uid as an integer for compatibility with runAsNonRoot in Kubernetes USER 65532 diff --git a/Dockerfile.alpine b/Dockerfile.alpine index d34cc6009..97ee1b3e4 100644 --- a/Dockerfile.alpine +++ b/Dockerfile.alpine @@ -15,8 +15,6 @@ # Use the latest stable golang 1.x to compile to a binary FROM --platform=$BUILDPLATFORM golang:1-alpine as build -LABEL org.opencontainers.image.source="https://github.com/GoogleCloudPlatform/cloud-sql-proxy" - WORKDIR /go/src/cloud-sql-proxy COPY . . @@ -29,6 +27,9 @@ RUN CGO_ENABLED=0 GOOS=${TARGETOS} GOARCH=${TARGETARCH} \ # Final stage FROM alpine:3@sha256:34871e7290500828b39e22294660bee86d966bc0017544e848dd9a255cdf59e0 + +LABEL org.opencontainers.image.source="https://github.com/GoogleCloudPlatform/cloud-sql-proxy" + RUN apk add --no-cache \ ca-certificates \ libc6-compat diff --git a/Dockerfile.bullseye b/Dockerfile.bullseye index 4f8fb53c0..6d2e30552 100644 --- a/Dockerfile.bullseye +++ b/Dockerfile.bullseye @@ -15,8 +15,6 @@ # Use the latest stable golang 1.x to compile to a binary FROM --platform=$BUILDPLATFORM golang:1 as build -LABEL org.opencontainers.image.source="https://github.com/GoogleCloudPlatform/cloud-sql-proxy" - WORKDIR /go/src/cloud-sql-proxy COPY . . @@ -29,6 +27,9 @@ RUN CGO_ENABLED=0 GOOS=${TARGETOS} GOARCH=${TARGETARCH} \ # Final stage FROM debian:bullseye@sha256:ab2b95aa8d7d6d54866b92c322cf0693933c1ae8038652f24ddfda1d1763a45a + +LABEL org.opencontainers.image.source="https://github.com/GoogleCloudPlatform/cloud-sql-proxy" + RUN apt-get update && apt-get install -y ca-certificates # Install fuse and allow enable non-root users to mount RUN apt-get update && apt-get install -y fuse && sed -i 's/^#user_allow_other$/user_allow_other/g' /etc/fuse.conf diff --git a/Dockerfile.buster b/Dockerfile.buster index 404bffa7b..1bb0a116c 100644 --- a/Dockerfile.buster +++ b/Dockerfile.buster @@ -15,8 +15,6 @@ # Use the latest stable golang 1.x to compile to a binary FROM --platform=$BUILDPLATFORM golang:1 as build -LABEL org.opencontainers.image.source="https://github.com/GoogleCloudPlatform/cloud-sql-proxy" - WORKDIR /go/src/cloud-sql-proxy COPY . . @@ -29,6 +27,9 @@ RUN CGO_ENABLED=0 GOOS=${TARGETOS} GOARCH=${TARGETARCH} \ # Final stage FROM debian:buster@sha256:46ca02d33c65ab188d6e56f26c323bf1aa9a99074f2f54176fdc3884304f58b8 + +LABEL org.opencontainers.image.source="https://github.com/GoogleCloudPlatform/cloud-sql-proxy" + RUN apt-get update && apt-get install -y ca-certificates # Install fuse and allow enable non-root users to mount RUN apt-get update && apt-get install -y fuse && sed -i 's/^#user_allow_other$/user_allow_other/g' /etc/fuse.conf