-
Notifications
You must be signed in to change notification settings - Fork 1
/
Dockerfile
30 lines (26 loc) · 949 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
FROM --platform=$BUILDPLATFORM rvolosatovs/protoc:4.0.0 AS proto
WORKDIR /build
COPY pkg/proto pkg/proto
RUN mkdir -p pkg/pb
RUN protoc --proto_path=pkg/proto --go_out=pkg/pb \
--go_opt=paths=source_relative --go-grpc_out=pkg/pb \
--go-grpc_opt=paths=source_relative pkg/proto/*.proto
FROM --platform=$BUILDPLATFORM golang:1.19-alpine AS builder
ARG TARGETOS
ARG TARGETARCH
WORKDIR /build
COPY go.mod go.sum ./
RUN go mod download
COPY . .
COPY --from=proto /build/pkg/pb pkg/pb
RUN env GOOS=$TARGETOS GOARCH=$TARGETARCH go build -o cloudsave-validator-grpc-plugin-server-go_$TARGETOS-$TARGETARCH
FROM alpine:3.19
ARG TARGETOS
ARG TARGETARCH
WORKDIR /app
COPY --from=builder /build/cloudsave-validator-grpc-plugin-server-go_$TARGETOS-$TARGETARCH cloudsave-validator-grpc-plugin-server-go
# Plugin arch gRPC server port
EXPOSE 6565
# Prometheus /metrics web server port
EXPOSE 8080
CMD [ "/app/cloudsave-validator-grpc-plugin-server-go" ]