Skip to content

Commit

Permalink
Minimize the Docker image (census-instrumentation#84)
Browse files Browse the repository at this point in the history
* Minimize the Docker image

Use a builder stage to minimize the final Docker image.

docker run -v config.yaml:/config.yaml  -p 55678:55678  <image>

Fixes census-instrumentation#73.

* Use Go.11
  • Loading branch information
rakyll authored and songy23 committed Oct 16, 2018
1 parent 3225ff3 commit 3ac2d3f
Showing 1 changed file with 19 additions and 4 deletions.
23 changes: 19 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,23 @@
FROM debian:jessie
FROM golang:1.11-alpine3.7 as builder

COPY ./bin/ocagent_linux ocagent
RUN apk update && apk upgrade && \
apk add --no-cache bash git openssh

# Expose the OpenCensus interceptor port
ENV GOPKG github.com/census-instrumentation/opencensus-service

COPY . /go/src/$GOPKG/

RUN go get $GOPKG/...
RUN cd /go/src/$GOPKG/ && ./build_binaries.sh linux && cp /go/src/$GOPKG/bin/ocagent_linux /ocagent

FROM alpine:3.7

RUN apk update && apk upgrade && \
apk add --no-cache bash git openssh

COPY --from=builder /ocagent /ocagent

# Expose the OpenCensus interceptor port.
EXPOSE 55678/tcp

CMD ["ocagent"]
CMD ["/ocagent"]

0 comments on commit 3ac2d3f

Please sign in to comment.