mirror of
https://github.com/docker/build-push-action.git
synced 2024-11-15 15:23:50 +08:00
99bea387ee
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
31 lines
815 B
Plaintext
31 lines
815 B
Plaintext
FROM --platform=${BUILDPLATFORM:-linux/amd64} tonistiigi/xx:golang AS xgo
|
|
FROM --platform=${BUILDPLATFORM:-linux/amd64} golang:1.13-alpine AS builder
|
|
|
|
ENV CGO_ENABLED 0
|
|
ENV GO111MODULE on
|
|
ENV GOPROXY https://goproxy.io
|
|
COPY --from=xgo / /
|
|
|
|
ARG TARGETPLATFORM
|
|
RUN go env
|
|
|
|
RUN apk --update --no-cache add \
|
|
build-base \
|
|
gcc \
|
|
git \
|
|
&& rm -rf /tmp/* /var/cache/apk/*
|
|
|
|
WORKDIR /app
|
|
|
|
ENV DIUN_VERSION="v4.4.0"
|
|
|
|
RUN git clone --branch ${DIUN_VERSION} https://github.com/crazy-max/diun .
|
|
RUN go mod download
|
|
RUN go build -ldflags "-w -s -X 'main.version=test'" -v -o diun cmd/main.go
|
|
|
|
FROM --platform=${TARGETPLATFORM:-linux/amd64} alpine:latest
|
|
|
|
COPY --from=builder /app/diun /usr/local/bin/diun
|
|
COPY --from=builder /usr/local/go/lib/time/zoneinfo.zip /usr/local/go/lib/time/zoneinfo.zip
|
|
RUN diun --version
|