-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile.example
More file actions
29 lines (21 loc) · 810 Bytes
/
Dockerfile.example
File metadata and controls
29 lines (21 loc) · 810 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
ARG GO_VERSION=1.23.5
######################################################### Base
FROM --platform=$BUILDPLATFORM golang:${GO_VERSION}-alpine AS base
RUN apk add --no-cache git tree dumb-init ca-certificates
######################################################### Build
FROM base as build
WORKDIR /app
COPY . .
RUN cd cmd/examples && \
go mod download -x && \
CGO_ENABLED=0 GOOS=linux GOARCH=arm64 go build -ldflags="-s -w" -o main .
######################################################### Runner
FROM scratch AS runner
WORKDIR /app
## Fiber PreFork
COPY --from=build /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
COPY --from=build /usr/bin/dumb-init /usr/bin/dumb-init
COPY --from=build /app/cmd/examples/main ./
EXPOSE 3000
ENTRYPOINT ["/usr/bin/dumb-init", "--"]
CMD ["./main"]