Skip to content

Make /home/i2pd mountable as a docker volume #10

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

Merged
merged 14 commits into from
Oct 8, 2024

Conversation

ShrirajHegde
Copy link
Contributor

@ShrirajHegde ShrirajHegde commented Jul 6, 2024

Store the files in /i2pd and copy them to /home/i2pd on entrypoint. This enables us to mount /home/i2pd/conf and /home/i2pd/data as docker volumes for persistance and easier editing of the config file.
- Split Dockerfile into more steps for optimal build caching.
- Move COPY statements just before use for optimal build caching.
- Build with `make -j nproc` to compile in parallel for faster compilation.
This makes it easier for users to edit i2pd.conf file when mounted to host directory.
Runs i2pd from /i2pd/bin/i2pd instead of /home/i2pd/bin/i2pd
- Manually create /home/i2pd/
…ally set in the container"

This reverts commit 829e360.

I missed that divax/i2p:current-i2p-tor has a separate Dockerfile and entrypoint script
@ShrirajHegde
Copy link
Contributor Author

ShrirajHegde commented Jul 7, 2024

@diva-exchange Can you provide the Dockerfile and entrypoint.sh for divax/i2p:current-i2p-tor image?

@ShrirajHegde
Copy link
Contributor Author

Hey @diva-exchange, I got the entrypoint.sh from your image and modified the Dockerfile to include tor.

  • It is better to keep them in the same branch, as branches are not recommended for this purpose. It is easier to build or maintain using a single branch.

  • I have pushed Dockerfile-tor and entrypoint-tor.sh. I have also optimized the Dockerfiles for size and build speed. Build the images and check for yourself.

  • Not only that, but I have carefully made changes that they do not change any behaviors. This is a great image for quickly setting up i2p. I have a few more changes related to config to make it even better.

  • When making a push to docker hub next time, consider building multi-platform images like this https://hub.docker.com/r/shrirajhegde/i2pd-tor/tags so it works on ARM platforms too.

Let me know if you want any more information.

@ShrirajHegde ShrirajHegde force-pushed the develop branch 2 times, most recently from 085b3fb to d109f06 Compare September 22, 2024 10:04
@ShrirajHegde ShrirajHegde force-pushed the develop branch 3 times, most recently from ed73219 to 8e07943 Compare September 29, 2024 05:29
@diva-exchange diva-exchange merged commit 441aa23 into diva-exchange:develop Oct 8, 2024
@diva-exchange
Copy link
Owner

Thank you - great feedback and great changes. Merged it and will test it with i2pd 2.54.0. One question remains: How to do build multi-platform images? Can this be included in the build.sh script?

@ShrirajHegde
Copy link
Contributor Author

@diva-exchange, yes.

I can build and push by

docker buildx build . \
    --platform linux/arm64,linux/amd64,linux/arm/v7 \
     -t shrirajhegde/i2pd-tor --push -f Dockerfile-tor

See that I am specifying all the platform and the specific docker file.
https://hub.docker.com/r/shrirajhegde/i2pd-tor

image

When it's built like this, if you do shrirajhegde/i2pd-tor:latest, your system will choose the architecture accordingly with no changes to docker compose or the docker run command.

For non tor variant, I do

docker buildx build . \
    --platform linux/arm64,linux/amd64,linux/arm/v7 \
     -t shrirajhegde/i2pd --push -f Dockerfile

https://hub.docker.com/r/shrirajhegde/i2pd/tags

But I would advice you to use GitHub actions like I do. I have set it up to build the image every week automatically. And the new image will be tagged with latest and git-<commit_hash> of i2pd repo.

It runs weekly at 9AM UTC : https://github.com/ShrirajHegde/i2pd/actions.

@ShrirajHegde
Copy link
Contributor Author

Let me know if you need help with setting up GitHub actions.

It's almost setup. It only requires minor changes and adding your docker secrets to GitHub.

@diva-exchange
Copy link
Owner

Great & thanks! Will enable github actions on the main branch. Reason: don't want to push develop branch to docker (since PR's [and also some not-that-well-tested commits] go to develop branch). But tested and approved stuff (which is the main branch) shall be published on docker hub.

@ShrirajHegde
Copy link
Contributor Author

If you need high stability, you need to checkout the latest release tag when building i2pd.

They might have commits that are not fully ready to be used too.

Let me know if you want to to implement that in the GitHub actions.

@ShrirajHegde
Copy link
Contributor Author

This commit also addresses #6. I am not sure if it fully fixes the issue.

diva-exchange added a commit that referenced this pull request Oct 8, 2024
### Changed
- I2Pd v2.54.0 (see ChangeLog-i2pd)
- docker improvements, credits and thanks to: #10
- I2Pd has removed dependencies to boost-filesystem and boost-date_time, also removed dependencies from Dockerfile
- removed Dockerfile-binary

### Fixed
- using tag (like "2.54.0") instead of branch to build i2pd
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.

[BUG] Host network binding not configurable [BUG] i2pd.conf is always unconditionally overwritten
2 participants