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

docker: speed up building, improve documentation #2222

Merged
merged 3 commits into from
Mar 31, 2025

Conversation

stickies-v
Copy link
Collaborator

@stickies-v stickies-v commented Mar 13, 2025

A couple of improvements to avoid unnecessary operations and speed up building the container when previewing the website with Docker Compose. Rationale for each change is documented in the commit message.

cc @arshbot - thank you for your earlier work on adding docker support in #1540 !

Note: you'll have to rebuild your docker image for this PR:

docker compose down && docker compose up --build

Verified

This commit was signed with the committer’s verified signature.
The user must already have the repo cloned to use the Dockerfile,
so don't clone it again. This speeds up the building process by
avoiding unnecessary operations and improving caching.

Verified

This commit was signed with the committer’s verified signature.
Best practice is to combine apt-get update and apt-get install
in one command to prevent caching issues.

See https://docs.docker.com/build/building/best-practices/#apt-get

Verified

This commit was signed with the committer’s verified signature.
Elaborate a bit more on the fact that manually rebuilding is
typically not necessary. Also remove the now deprecated
docker-compose (V1) and replace it with docker compose (v2).
@bitschmidty
Copy link
Contributor

I'm guessing you might not have rebuilt your Docker image? ... - I think that should address your issue?

Yes, that was it indeed! I thought if I nuked the containers in the Docker GUI that would have forced a rebuild on future uses, but apparently not. Thanks!

Copy link
Contributor

@bitschmidty bitschmidty left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tACK, thank you @stickies-v !

@bitschmidty bitschmidty merged commit 2858be4 into bitcoinops:master Mar 31, 2025
2 checks passed
@stickies-v stickies-v deleted the improve-docker branch March 31, 2025 15:30
azuchi pushed a commit to azuchi/bitcoinops.github.io that referenced this pull request Apr 4, 2025
* docker: avoid unnecessary cloning

The user must already have the repo cloned to use the Dockerfile,
so don't clone it again. This speeds up the building process by
avoiding unnecessary operations and improving caching.

* docker: make caching more robust

Best practice is to combine apt-get update and apt-get install
in one command to prevent caching issues.

See https://docs.docker.com/build/building/best-practices/#apt-get

* docker: improve README

Elaborate a bit more on the fact that manually rebuilding is
typically not necessary. Also remove the now deprecated
docker-compose (V1) and replace it with docker compose (v2).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants