-
Notifications
You must be signed in to change notification settings - Fork 3
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
chore: [VIO-3019] Update the Dockerfiles #119
base: develop
Are you sure you want to change the base?
Conversation
Update the `Dockerfile`s to use the `debian:stable-slim` as the builder, and `scratch` for the final (production) 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.
I think it is time to move away from COPY synse-emulator-plugin ./plugin
. We get away with this because goreleaser ends up pushing the docker image. However it won't make sense for a user if they have to download the whole toolchain on host to compile the binary when we're using a builder for Docker.
Build the go binary statically linked so that it works in the `scratch` image. Runs as the `vaporio` user, instead of root.
This updated PR does two things: builds the go binary statically (the default dynamically linked binary doesn't run inside the Runs the binary as a specific user. That's a new pattern we're adopting across Dockerfiles. |
Looks like it's failing with goreleaser. I see now that gorelease is building the binary and then trying to build the Dockerfile, and I'm reading through how we should be structuring the Dockerfile to work with goreleaser. I'll migrate my Dockerfile changes to |
In `dev.Dockerfile`, build the binary inside the Dockerfile build. In `Dockerfile`, follow the goreleaser pattern In `Makefile`, the `docker` target builds the image via gobuilder In `README.md`, add a "build" section to link to the goreleaser install page and document how to build the production image locally.
I refactored the Dockerfile(s) a bit. First, I moved the changes I'd made to build the go binary in the docker build to |
One last note: it looks like the |
Update the
Dockerfile
s to use thedebian:stable-slim
as the builder, andscratch
for the final (production) image.Final image size reduced from 14.5MB to 14MB.