refactor:

This commit is contained in:
Vyacheslav1557 2024-08-16 16:05:29 +05:00
parent ad8d145986
commit 3c0f01630f
29 changed files with 360 additions and 1377 deletions

View file

@ -1,9 +1,15 @@
FROM golang:latest
FROM golang:1.22-alpine AS base
WORKDIR /src
RUN --mount=type=cache,target=/go/pkg/mod/ \
--mount=type=bind,source=go.sum,target=go.sum \
--mount=type=bind,source=go.mod,target=go.mod \
go mod download -x
WORKDIR /app
FROM base AS builder
RUN --mount=type=cache,target=/go/pkg/mod/ \
--mount=type=bind,target=. \
go build -o /bin/server .
COPY . .
RUN go build ./main.go
CMD ["./main"]
FROM scratch AS runner
COPY --from=builder /bin/server /bin/
ENTRYPOINT [ "/bin/server" ]