-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
52 lines (28 loc) · 854 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
43
44
45
46
47
48
49
50
51
52
FROM golang:1.23.2-alpine3.20 AS chef
WORKDIR /app
RUN apk update && apk upgrade --no-cache && \
apk add --no-cache protoc make
FROM chef AS proto-builder
WORKDIR /build
RUN apk update && apk upgrade --no-cache && \
apk add --no-cache protoc make
RUN go install google.golang.org/protobuf/cmd/protoc-gen-go@latest && \
go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@latest
COPY proto proto
RUN --mount=type=bind,source=Makefile,target=Makefile \
make proto
FROM chef AS grpc-builder
WORKDIR /build
COPY --from=proto-builder /build/proto proto
ADD . .
RUN make grpc-build
FROM alpine:3.20 AS runner
WORKDIR /var/app
COPY --from=grpc-builder /build/bin/grpc .
RUN mkdir logs
RUN addgroup -S app && \
adduser -S chitty -G app && \
chown -R chitty:app /var/app
USER chitty
EXPOSE 8080
CMD ["./grpc"]