-
Notifications
You must be signed in to change notification settings - Fork 173
Convert docker image to use alpine base #498
Conversation
docker images | grep uchiwa uchiwa alpine 8f1ecc470f0f 2 minutes ago 322.7 MB uchiwa latest 1585aac90bf3 23 minutes ago 824.1 MB Shrunk the total image size by more than half and also decreased the image build time.
Also add a .dockerignore file to ensure .git doesn't end up in the image. This reduces the built image size to 301MB, the base golang alpine image is 225M so I think some more things can be purged but this is a huge improvement over using the debian base.
Thank you very much for this PR! I'll have to run some tests but everything looks good, I'll try to have it merged ASAP! |
COPY . /go/src/app | ||
WORKDIR /go/src/app | ||
RUN apk add --no-cache nodejs git && \ | ||
go get -d -v && \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The go source files can be deleted after build as well. I recommend using glide or some other vendoring tool, which installs the deps into a single vendor/
directory which can be easily removed after build.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This requires setting GOVENDOREXPERIMENT
since you're still on go1.5.
Upgrading to go1.6 already has this set by default.
|
docker images | grep uchiwa
uchiwa alpine 8f1ecc470f0f 2 minutes ago 301 MB
uchiwa latest 1585aac90bf3 23 minutes ago 824.1 MB
Shrunk the total image size by more than half and also decreased the image build time.
For #462