mirror of
https://github.com/docker/build-push-action
synced 2024-11-14 15:21:41 +00:00
472ccddef1
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
16 lines
348 B
Docker
16 lines
348 B
Docker
FROM golang:1.19-alpine AS base
|
|
ENV CGO_ENABLED=0
|
|
RUN apk add --no-cache file git
|
|
WORKDIR /src
|
|
|
|
FROM base as build
|
|
COPY go.mod go.sum ./
|
|
RUN go mod download -x
|
|
COPY . .
|
|
RUN go build -ldflags "-s -w" -o /usr/bin/app .
|
|
|
|
FROM scratch AS binary
|
|
COPY --from=build /usr/bin/app /bin/app
|
|
|
|
FROM alpine:3.17 AS image
|
|
COPY --from=build /usr/bin/app /bin/app
|