-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
30 lines (26 loc) · 935 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.23-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 session-manager-grpc-plugin-server-go_$TARGETOS-$TARGETARCH
FROM alpine:3.19.0
ARG TARGETOS
ARG TARGETARCH
WORKDIR /app
COPY --from=builder /build/session-manager-grpc-plugin-server-go_$TARGETOS-$TARGETARCH session-manager-grpc-plugin-server-go
# Plugin arch gRPC server port
EXPOSE 6565
# Prometheus /metrics web server port
EXPOSE 8080
CMD [ "/app/session-manager-grpc-plugin-server-go" ]