-
Notifications
You must be signed in to change notification settings - Fork 9
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
New dockerfile that can build by itself #78
Conversation
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.
Looks great, Chris!
Dockerfile
Outdated
WORKDIR /gopath/src/github.com/operable/go-relay | ||
COPY . /gopath/src/github.com/operable/go-relay | ||
|
||
RUN apk -U add \ |
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.
It's common to use apk -U add --virtual .build_deps <packages>
followed by apk del .build_deps && rm -rf /var/cache/apk/*
Not sure if that would help squeeze anything more out of the image.
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.
@jesselang I'll go ahead and add the virtual package if for no other reason than to promote good patterns via copy and paste 😄
I'd forgotten about removing the APK cache; I'll give that a try this evening and see if it helps. Either way, I'll merge it afterward.
Thanks for the review!
Previously, we'd build a glibc Relay locally and then stuff that into a minimal Docker image and provide that. Now, we do the build of Relay inside the image build itself. I have confirmed that an executable built in this Alpine image runs fine in a Debian (i.e., glibc) system. However, this results in a larger image size right now. Compare the previous sizes to what is currently built by this commit: | Image | Compressed | Uncompressed | | -------- | ---------- | ------------ | | Previous | 6 MB | 19.9 MB | | Current | 30 MB | 81.6 MB | This allows us to easily automate the build with DockerHub, though, because it doesn't require anything besides the Dockerfile. See operable/cog#1384 for more.
09ff8bf
to
8eb92aa
Compare
@jesselang That shaved off another ~0.8MB, so 👍 |
Previously, we'd build a glibc Relay locally and then stuff that into a
minimal Docker image and provide that. Now, we do the build of Relay
inside the image build itself. I have confirmed that an executable built
in this Alpine image runs fine in a Debian (i.e., glibc) system.
However, this results in a larger image size right now. Compare the
previous sizes to what is currently built by this commit:
This allows us to easily automate the build with DockerHub, though,
because it doesn't require anything besides the Dockerfile.
See operable/cog#1384 for more.