refactor:
This commit is contained in:
parent
ad8d145986
commit
3c0f01630f
29 changed files with 360 additions and 1377 deletions
20
Dockerfile
20
Dockerfile
|
@ -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" ]
|
Loading…
Add table
Add a link
Reference in a new issue