Skip to content

Commit

Permalink
chore: use base images from mcr
Browse files Browse the repository at this point in the history
Signed-off-by: Anish Ramasekar <[email protected]>
  • Loading branch information
aramase committed Dec 13, 2023
1 parent a93f474 commit 41fb0e0
Show file tree
Hide file tree
Showing 7 changed files with 10 additions and 22 deletions.
2 changes: 1 addition & 1 deletion docker/proxy-init.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM --platform=${TARGETPLATFORM:-linux/amd64} registry.k8s.io/build-image/distroless-iptables:v0.4.2
FROM --platform=${TARGETPLATFORM:-linux/amd64} registry.k8s.io/build-image/distroless-iptables:v0.4.3

COPY ./init/init-iptables.sh /bin/
RUN chmod +x /bin/init-iptables.sh
Expand Down
7 changes: 2 additions & 5 deletions docker/proxy.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
ARG BUILDER=mcr.microsoft.com/oss/go/microsoft/golang:1.21-bullseye
ARG BASEIMAGE=gcr.io/distroless/static:nonroot
ARG BASEIMAGE=mcr.microsoft.com/cbl-mariner/distroless/minimal:2.0-nonroot

FROM ${BUILDER} as builder
FROM mcr.microsoft.com/oss/go/microsoft/golang:1.21-bookworm as builder

ARG LDFLAGS

Expand All @@ -21,8 +20,6 @@ COPY pkg/ pkg/
ARG TARGETARCH
RUN CGO_ENABLED=0 GOOS=linux GOARCH=${TARGETARCH} GO111MODULE=on go build -a -ldflags "${LDFLAGS:--X github.com/Azure/azure-workload-identity/pkg/version.BuildVersion=latest}" -o proxy main.go

# Use distroless as minimal base image to package the manager binary
# Refer to https://github.com/GoogleContainerTools/distroless for more details
FROM --platform=${TARGETPLATFORM:-linux/amd64} ${BASEIMAGE}
WORKDIR /
COPY --from=builder /workspace/proxy .
Expand Down
7 changes: 2 additions & 5 deletions docker/webhook.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
ARG BUILDER=mcr.microsoft.com/oss/go/microsoft/golang:1.21-bullseye
ARG BASEIMAGE=gcr.io/distroless/static:nonroot
ARG BASEIMAGE=mcr.microsoft.com/cbl-mariner/distroless/minimal:2.0-nonroot

# Build the manager binary
FROM ${BUILDER} as builder
FROM mcr.microsoft.com/oss/go/microsoft/golang:1.21-bookworm as builder

ARG LDFLAGS

Expand All @@ -22,8 +21,6 @@ COPY pkg/ pkg/
ARG TARGETARCH
RUN CGO_ENABLED=0 GOOS=linux GOARCH=${TARGETARCH} GO111MODULE=on go build -a -ldflags "${LDFLAGS:--X github.com/Azure/azure-workload-identity/pkg/version.BuildVersion=latest}" -o manager main.go

# Use distroless as minimal base image to package the manager binary
# Refer to https://github.com/GoogleContainerTools/distroless for more details
FROM --platform=${TARGETPLATFORM:-linux/amd64} ${BASEIMAGE}
WORKDIR /
COPY --from=builder /workspace/manager .
Expand Down
7 changes: 2 additions & 5 deletions examples/msal-go/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
ARG BUILDER=mcr.microsoft.com/oss/go/microsoft/golang:1.21-bullseye
ARG BASEIMAGE=gcr.io/distroless/static:nonroot
ARG BASEIMAGE=mcr.microsoft.com/cbl-mariner/distroless/minimal:2.0-nonroot

FROM ${BUILDER} as builder
FROM mcr.microsoft.com/oss/go/microsoft/golang:1.21-bookworm as builder

WORKDIR /workspace
# Copy the Go Modules manifests
Expand All @@ -19,8 +18,6 @@ COPY token_credential.go token_credential.go
ARG TARGETARCH
RUN CGO_ENABLED=0 GOOS=linux GOARCH=${TARGETARCH} GO111MODULE=on go build -a -o msalgo .

# Use distroless as minimal base image to package the manager binary
# Refer to https://github.com/GoogleContainerTools/distroless for more details
FROM --platform=${TARGETPLATFORM:-linux/amd64} ${BASEIMAGE}
WORKDIR /
COPY --from=builder /workspace/msalgo .
Expand Down
3 changes: 1 addition & 2 deletions examples/msal-go/windows.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
ARG BUILDER=mcr.microsoft.com/oss/go/microsoft/golang:1.21-bullseye
ARG SERVERCORE_CACHE=gcr.io/k8s-staging-e2e-test-images/windows-servercore-cache:1.0-linux-amd64-${OS_VERSION:-1809}
ARG BASEIMAGE=mcr.microsoft.com/windows/nanoserver:${OS_VERSION:-1809}

FROM --platform=linux/amd64 ${BUILDER} as builder
FROM --platform=linux/amd64 mcr.microsoft.com/oss/go/microsoft/golang:1.21-bookworm

WORKDIR /workspace
# Copy the Go Modules manifests
Expand Down
4 changes: 1 addition & 3 deletions examples/msal-node/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
ARG BUILDER=mcr.microsoft.com/cbl-mariner/base/nodejs:16
ARG BASEIMAGE=mcr.microsoft.com/mirror/gcr/distroless/nodejs-debian11:16

# ref: https://github.com/GoogleContainerTools/distroless/blob/main/examples/nodejs/Dockerfile
FROM ${BUILDER} AS build-env
FROM mcr.microsoft.com/oss/go/microsoft/golang:1.21-bookworm as build-env
ADD . /app
WORKDIR /app
RUN npm install
Expand Down
2 changes: 1 addition & 1 deletion examples/msal-python/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
ARG BUILDER=debian:11-slim
ARG BASEIMAGE=gcr.io/distroless/python3-debian11
ARG BASEIMAGE=mcr.microsoft.com/cbl-mariner/distroless/python:3.9

# ref: https://github.com/GoogleContainerTools/distroless/blob/main/examples/python3-requirements/Dockerfile
FROM ${BUILDER} AS build
Expand Down

0 comments on commit 41fb0e0

Please sign in to comment.