2023-04-09 00:33:30 -04:00
|
|
|
# syntax=docker/dockerfile:1
|
|
|
|
|
|
|
|
FROM golang:alpine AS base
|
2022-12-19 16:06:29 -05:00
|
|
|
ENV CGO_ENABLED=0
|
|
|
|
RUN apk add --no-cache file git
|
|
|
|
WORKDIR /src
|
|
|
|
|
2023-04-09 00:33:30 -04: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 16:06:29 -05:00
|
|
|
|
|
|
|
FROM scratch AS binary
|
|
|
|
COPY --from=build /usr/bin/app /bin/app
|
|
|
|
|
2023-04-09 00:33:30 -04:00
|
|
|
FROM alpine AS image
|
2022-12-19 16:06:29 -05:00
|
|
|
COPY --from=build /usr/bin/app /bin/app
|
2023-04-09 00:33:30 -04:00
|
|
|
EXPOSE 8080
|
|
|
|
ENTRYPOINT ["/bin/app"]
|