Skip to content
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

Streamline Dockerfile for caching and size #457

Merged
merged 6 commits into from
Dec 11, 2020

Conversation

joakimfors
Copy link
Contributor

Use newer base images and modify Dockerfile to allow for better caching and smaller image file size. Simplify entry script and run as a non-root user.

@scara
Copy link

scara commented Jun 18, 2020

Cool!
If multi-stage cannot be adopted here (Docker 17.05+), multi-stage could be emulated via https://docs.docker.com/develop/develop-images/multistage-build/#before-multi-stage-builds.

HTH,
Matteo

@petrsloup
Copy link
Member

Cool, but does the simplified script cover all the cases why the original run.sh is so complicated?

There were some concerns especially about the restartability of the container and waiting for xvfb to start up properly.

See #310, #313 and also #242

@joakimfors
Copy link
Contributor Author

The xvfb-run wrapper script that is included in the Debian xvfb packages takes care of all setup. However, #242 could be a separate issue. Will check that.

Move package installation to top of file to enable layer caching
in Docker. Use multi stage builds to reduce final image size.
Ignore everything but essential files when creating Docker build
context.
Start Xvfb wrapper in background and wait for the process to complete.
Because wait exits immediately when a signal for which a trap has been
set, and the signal handler is executed directly after that, we need to
wait again for the background processes to actually finish before exiting.

The signal handler catches INT and TERM and forwards them to the node
process.

The return value from the first wait is stored and sent as exit value.
@joakimfors
Copy link
Contributor Author

OK, 6b3f557 should cover the same issue as #242

@petrsloup petrsloup merged commit 51baa9b into maptiler:master Dec 11, 2020
@petrsloup
Copy link
Member

Thanks, merged.

@fabiuk fabiuk mentioned this pull request Dec 23, 2020
strikehawk pushed a commit to strikehawk/tileserver-gl that referenced this pull request Apr 22, 2021
Streamline Dockerfile for caching and size
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants