2020-01-11 20:18:50 +00:00
|
|
|
# Extract graphviz and dependencies
|
2020-06-02 18:59:11 +00:00
|
|
|
FROM golang:1.14.3-buster AS deb_extractor
|
2020-01-11 20:18:50 +00:00
|
|
|
RUN cd /tmp && \
|
|
|
|
apt-get update && apt-get download \
|
|
|
|
graphviz libgvc6 libcgraph6 libltdl7 libxdot4 libcdt5 libpathplan4 libexpat1 zlib1g && \
|
|
|
|
mkdir /dpkg && \
|
|
|
|
for deb in *.deb; do dpkg --extract $deb /dpkg || exit 10; done
|
|
|
|
|
2020-06-02 18:59:11 +00:00
|
|
|
FROM golang:1.14.3-buster AS builder
|
|
|
|
COPY go.mod go.sum pprofweb.go /go/src/pprofweb/
|
|
|
|
WORKDIR /go/src/pprofweb
|
|
|
|
RUN go build --mod=readonly pprofweb.go
|
2020-01-11 20:18:50 +00:00
|
|
|
|
2020-01-20 15:55:01 +00:00
|
|
|
FROM gcr.io/distroless/base-debian10:latest AS run
|
2020-01-11 20:18:50 +00:00
|
|
|
COPY --from=builder /go/src/pprofweb/pprofweb /pprofweb
|
|
|
|
COPY --from=deb_extractor /dpkg /
|
|
|
|
# Configure dot plugins
|
|
|
|
RUN ["dot", "-c"]
|
|
|
|
|
|
|
|
# Use a non-root user: slightly more secure (defense in depth)
|
2020-01-20 15:55:01 +00:00
|
|
|
USER nobody
|
2020-01-11 20:18:50 +00:00
|
|
|
WORKDIR /
|
|
|
|
EXPOSE 8080
|
|
|
|
ENTRYPOINT ["/pprofweb"]
|