-
Notifications
You must be signed in to change notification settings - Fork 512
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update minimal dockerfiles to use multi-stage builds to achieve minimalness #1312
Conversation
7b817a6
to
658640a
Compare
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.
LGTM
server.minimal.Dockerfile
Outdated
FROM busybox:latest | ||
MAINTAINER David Lawrence "[email protected]" | ||
|
||
# the ln is for compatibility with the docker-compose.yml, making these | ||
# the line is for compatibility with the docker-compose.yml, making these |
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.
that meant ln
ie the symlink
signer.minimal.Dockerfile
Outdated
FROM busybox:latest | ||
MAINTAINER David Lawrence "[email protected]" | ||
|
||
# the ln is for compatibility with the docker-compose.yml, making these | ||
# the line is for compatibility with the docker-compose.yml, making these |
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.
and here
looks fine bar comment about comment but needs a rebase. |
658640a
to
c6537a2
Compare
Thanks @justincormack! Fixed. |
@@ -1,19 +1,38 @@ | |||
FROM golang:1.9.4-alpine AS build-env | |||
RUN apk add --update git gcc libc-dev |
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.
If "tiny-ness" is important; use --no-cache
instead;
docker build -t before -<<EOF
FROM golang:1.9.4-alpine AS build-env
RUN apk add --update git gcc libc-dev
EOF
docker build -t after -<<EOF
FROM golang:1.9.4-alpine AS build-env
RUN apk add --no-cache git gcc libc-dev
EOF
REPOSITORY CREATED SIZE
after Less than a second ago 386MB
before Less than a second ago 387MB
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 is using a build image and a final image, though - does the no-cache affect the final image? This is the before and after image built with the server.minimal.Dockerfile
, without the --no-cache
option and with the --no-cache
option:
REPOSITORY TAG IMAGE ID CREATED SIZE
<none> <none> fa5c316b8562 17 seconds ago 540MB
after latest f3f0621261c3 About a minute ago 21.1MB
before latest f3f0621261c3 About a minute ago 21.1MB
<none> <none> 82a30458273b About a minute ago 540MB
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.
No it doesn't affect the final image (but does affect your local cache 😅); it was mainly a nit, and I wanted to mention --no-cache
because it's awesome: it takes care of everything (updating the index, and removing it afterwards)
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.
Oh nice! It seems to only be a MB or less, so in this case it seems ok, but I will keep that in mind for all my other images!
…alness. Signed-off-by: cyli <[email protected]>
c6537a2
to
0b704b7
Compare
cc @endophage @justincormack