3
0
Fork 0
mirror of https://gitea.com/docker/build-push-action.git synced 2024-11-23 01:49:38 +01:00
docker-build-push/test/go/Dockerfile

17 lines
348 B
Text
Raw Normal View History

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