mirror of
https://github.com/docker/build-push-action.git
synced 2025-04-19 01:46:45 +00:00
test: go project sample
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
This commit is contained in:
parent
d235d2d5ea
commit
472ccddef1
4 changed files with 104 additions and 0 deletions
16
test/go/Dockerfile
Normal file
16
test/go/Dockerfile
Normal file
|
@ -0,0 +1,16 @@
|
|||
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
|
Loading…
Add table
Add a link
Reference in a new issue