-
-
Notifications
You must be signed in to change notification settings - Fork 734
build: Optimize Dockerfile #3919
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
base: develop
Are you sure you want to change the base?
build: Optimize Dockerfile #3919
Conversation
|
thanks for the update. I will merge #3904 because it is kinda needed/a bugfix. After that I will review your PR. Please note that I made some changes to the build/container setup to allow for the integrated nginx. once I merged the other PR it would be great if you could check that everything is still working as expected. Also with the change to non root user: we need to be 1000% sure that this does not break anything like media file access or what not. As far as I am aware it is not needed/not heavily recommended to run the container as a non root users, its just a nice to have and I simply don't have the capacity for any kind of headache for something that is not absolutely needed. |
|
ok so the other changes to the docker file are done. Can you update your PR? Also what about the non root user, are we sure that this works 100%? |
Thanks, I will update when I get the chance. The nginx changes aren't tested yet and I assume they're breaking changes to what's here. A multi-service image will be more complex permission wise than the previous single service. nginx will likely want to be root so just setting a |
|
Do not add things to the Dockerfile that should be done on the host. Things like The point of running a container as non-root is to give it fewer privileges, not more. The container should do the least amount of things. I've been running Tandoor Recipes as a non-root, read-only, with all capabilities dropped for a couple of months now, after doing some minor adjustments to the Dockerfile and boot.sh. Since FS is read-only, run folder cannot be modified, so in boot.sh I've created user and group on the host I removed Here's my docker compose... |
Description
Refactor the Dockerfile for readability, while optimizing for a slimmer final image by reducing the layers and stripping the build dependencies from the production image
Background
I wanted to start contributing to issues, but got side tracked during setup. This is a work in progress as it will require more testing. The image itself relies on external dependencies not included in the Dockerfile (looking at the CI pipelines) and since I haven't got the dev environment up and running yet, unsure which dependencies are solely for building and which are required for production, but err-ed on the side of caution rather than optimization.
Discussion
Created an Issue for larger discussion that can be found here
Questions
I didn't see anywhere that was tagged with contribution / discussion around DevOps, CI/CD, building, etc, but if I missed it please feel free to point me in the correct direction!
Relevant Links
nginxnot being incorporated into the image itself (i use traefik as a reverse proxy), but if people like it incorporated, it may be more flexible to run it as a service rather than part of aboot.sh. s6 overlay has been great for this kind of thing