33 строки
1.4 KiB
Docker
33 строки
1.4 KiB
Docker
ARG ARCH
|
|
ARG DROPGZ_VERSION=v0.0.12
|
|
ARG OS
|
|
ARG OS_VERSION
|
|
|
|
FROM --platform=linux/${ARCH} mcr.microsoft.com/oss/go/microsoft/golang:1.21 AS azure-ipam
|
|
ARG OS
|
|
ARG VERSION
|
|
WORKDIR /azure-ipam
|
|
COPY ./azure-ipam .
|
|
RUN GOOS=$OS CGO_ENABLED=0 go build -a -o /go/bin/azure-ipam -trimpath -ldflags "-X main.version="$VERSION"" -gcflags="-dwarflocationlists=true" .
|
|
|
|
FROM --platform=linux/${ARCH} mcr.microsoft.com/cbl-mariner/base/core:2.0 AS compressor
|
|
ARG OS
|
|
WORKDIR /payload
|
|
COPY --from=azure-ipam /go/bin/* /payload
|
|
COPY --from=azure-ipam /azure-ipam/*.conflist /payload
|
|
RUN cd /payload && sha256sum * > sum.txt
|
|
RUN gzip --verbose --best --recursive /payload && for f in /payload/*.gz; do mv -- "$f" "${f%%.gz}"; done
|
|
|
|
FROM --platform=linux/${ARCH} mcr.microsoft.com/oss/go/microsoft/golang:1.21 AS dropgz
|
|
ARG DROPGZ_VERSION
|
|
ARG OS
|
|
ARG VERSION
|
|
RUN go mod download github.com/azure/azure-container-networking/dropgz@$DROPGZ_VERSION
|
|
WORKDIR /go/pkg/mod/github.com/azure/azure-container-networking/dropgz\@$DROPGZ_VERSION
|
|
COPY --from=compressor /payload/* pkg/embed/fs/
|
|
RUN GOOS=$OS CGO_ENABLED=0 go build -a -o /go/bin/dropgz -trimpath -ldflags "-X github.com/Azure/azure-container-networking/dropgz/internal/buildinfo.Version="$VERSION"" -gcflags="-dwarflocationlists=true" main.go
|
|
|
|
FROM mcr.microsoft.com/windows/nanoserver:${OS_VERSION}
|
|
COPY --from=dropgz /go/bin/dropgz dropgz
|
|
ENTRYPOINT [ "/dropgz" ]
|