-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
33 lines (24 loc) · 1.09 KB
/
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
FROM golang:1.19 AS builder
# go install github.com/grpc-ecosystem/grpc-health-probe@latest
RUN GRPC_HEALTH_PROBE_VERSION=v0.4.11 && \
wget -qO/bin/grpc_health_probe https://github.com/grpc-ecosystem/grpc-health-probe/releases/download/${GRPC_HEALTH_PROBE_VERSION}/grpc_health_probe-linux-amd64 && \
chmod +x /bin/grpc_health_probe
RUN apt-get update
RUN apt-get install ca-certificates -y
RUN update-ca-certificates
ENV GOPATH=/go
ENV PATH=${GOPATH}/bin:$PATH
WORKDIR "/build/src"
COPY go.mod .
COPY go.sum .
RUN --mount=type=cache,target=/go/pkg/mod go mod download
RUN --mount=type=cache,target=/go/pkg/mod go mod verify
COPY . .
RUN --mount=type=cache,target=/go/pkg/mod CGO_ENABLED=0 GOOS=linux go build -tags release -ldflags '-s -d -w' -o /build/dist/grpc_reflection /build/src/cmd/reflection
#FROM scratch
#COPY --from=builder /usr/share/zoneinfo /usr/share/zoneinfo
#COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
FROM alpine:latest
COPY --from=builder /bin/grpc_health_probe /bin/grpc_health_probe
COPY --from=builder "/build/dist/" /
ENTRYPOINT ["/grpc_reflection"]