1
0
Files
build-push-action/test/go/Dockerfile
T

20 lines
440 B
Docker
Raw Normal View History

2023-04-09 06:33:30 +02:00
# syntax=docker/dockerfile:1
FROM golang:alpine AS base
2022-12-19 22:06:29 +01:00
ENV CGO_ENABLED=0
RUN apk add --no-cache file git
WORKDIR /src
2023-04-09 06:33:30 +02:00
FROM base AS build
RUN --mount=type=bind,target=/src \
--mount=type=cache,target=/root/.cache/go-build \
go build -ldflags "-s -w" -o /usr/bin/app .
2022-12-19 22:06:29 +01:00
FROM scratch AS binary
COPY --from=build /usr/bin/app /bin/app
2023-04-09 06:33:30 +02:00
FROM alpine AS image
2022-12-19 22:06:29 +01:00
COPY --from=build /usr/bin/app /bin/app
2023-04-09 06:33:30 +02:00
EXPOSE 8080
ENTRYPOINT ["/bin/app"]