forked from fullstorydev/grpcui
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
30 lines (26 loc) · 1.01 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
FROM golang:1.21-alpine as builder
MAINTAINER Fullstory Engineering
# create non-privileged group and user
RUN addgroup -S grpcui && adduser -S grpcui -G grpcui
WORKDIR /tmp/fullstorydev/grpcui
# copy just the files/sources we need to build grpcui
COPY VERSION *.go go.* /tmp/fullstorydev/grpcui/
COPY cmd /tmp/fullstorydev/grpcui/cmd
COPY internal /tmp/fullstorydev/grpcui/internal
COPY standalone /tmp/fullstorydev/grpcui/standalone
# and build a completely static binary (so we can use
# scratch as basis for the final image)
ENV CGO_ENABLED=0
ENV GO111MODULE=on
RUN go build -o /grpcui \
-ldflags "-w -extldflags \"-static\" -X \"main.version=$(cat VERSION)\"" \
./cmd/grpcui
# New FROM so we have a nice'n'tiny image
FROM scratch
WORKDIR /
COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt
COPY --from=builder /etc/passwd /etc/passwd
COPY --from=builder /grpcui /bin/grpcui
USER grpcui
EXPOSE 8080
ENTRYPOINT ["/bin/grpcui", "-bind=0.0.0.0", "-port=8080", "-open-browser=false"]