Skip to content
This repository has been archived by the owner on Aug 6, 2018. It is now read-only.

Commit

Permalink
Remove build deps after build
Browse files Browse the repository at this point in the history
This shrinks the docker image from 300+ MB to 14 MB.
  • Loading branch information
rubenv committed Sep 28, 2017
1 parent 9a4e69f commit 16544b4
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions Dockerfile
Expand Up @@ -2,9 +2,11 @@ FROM alpine:latest

EXPOSE 9130

RUN apk update ; apk add go ; apk add git ; apk add musl-dev ; \
go get github.com/mdlayher/unifi_exporter/cmd/unifi_exporter; \
mv ~/go/bin/unifi_exporter /bin/
RUN apk add --update --virtual build-deps go git musl-dev && \
go get github.com/mdlayher/unifi_exporter/cmd/unifi_exporter && \
mv ~/go/bin/unifi_exporter /bin/ && \
apk del build-deps && \
rm -rf /var/cache/apk/* ~/go/

USER nobody
ENTRYPOINT ["/bin/unifi_exporter"]

0 comments on commit 16544b4

Please sign in to comment.