-
Notifications
You must be signed in to change notification settings - Fork 15
/
Dockerfile
42 lines (20 loc) · 874 Bytes
/
Dockerfile
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
30
31
32
33
34
35
36
37
38
39
40
41
42
# syntax = docker/dockerfile:1
ARG GOLANG=golang:1.23
FROM ${GOLANG} AS base
ENTRYPOINT [ "go", "run" ]
CMD [ "./cmd/profile" ]
FROM base AS debugger
ENTRYPOINT [ "go", "run", "-mod=mod", "github.com/go-delve/delve/cmd/dlv@latest"]
CMD [ "debug", "./cmd/profile", "--headless", "--listen=:2345", "--accept-multiclient", "--continue", "--build-flags='-buildvcs=false'" , "--api-version=2"]
FROM base AS builder
WORKDIR /src
COPY ./ ./
RUN --mount=type=cache,target=/go/pkg/mod \
--mount=type=cache,target=/root/.cache/go-build \
CGO_ENABLED=0 GOOS=linux go build -o profile ./cmd/profile
FROM alpine AS alpine
RUN apk add --no-cache ca-certificates
FROM scratch
COPY --from=alpine /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt
COPY --from=builder /src/profile /usr/local/bin/profile
ENTRYPOINT ["/usr/local/bin/profile"]