docker: Minimize image size (#2585)

This takes the image size from 823.1MB (current edge) to 281.8MB.

The following steps are taken:
  0) Use go-alpine for a much smaller base image
  1) Perform all actions in 1 step to eliminate diff images
  2) Remove unused files created after setup
master
Andrew Stone 8 years ago committed by Harshavardhana
parent 5716f1c199
commit 3118195e92
  1. 17
      Dockerfile

@ -1,14 +1,17 @@
FROM golang:1.6 FROM golang:1.6-alpine
RUN mkdir -p /go/src/app
WORKDIR /go/src/app WORKDIR /go/src/app
ENV ALLOW_CONTAINER_ROOT=1
COPY . /go/src/app COPY . /go/src/app
RUN go-wrapper download RUN \
RUN go-wrapper install apk add --no-cache git && \
go-wrapper download && \
ENV ALLOW_CONTAINER_ROOT=1 go-wrapper install && \
RUN mkdir -p /export/docker && cp /go/src/app/docs/Docker.md /export/docker/ mkdir -p /export/docker && \
cp /go/src/app/docs/Docker.md /export/docker/ && \
rm -rf /go/pkg /go/src && \
apk del git
EXPOSE 9000 EXPOSE 9000
ENTRYPOINT ["go-wrapper", "run", "server"] ENTRYPOINT ["go-wrapper", "run", "server"]

Loading…
Cancel
Save