.dockerignore: allowlist for copying into the Docker context#10578
.dockerignore: allowlist for copying into the Docker context#10578schildbach wants to merge 1 commit intolightningnetwork:masterfrom
Conversation
Summary of ChangesHello @schildbach, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request introduces a Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Changelog
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request aims to improve Docker build performance and security by adding a .dockerignore file, addressing the security risk of sensitive files being leaked into Docker images. However, the current approach of ignoring all files (*) is too broad and breaks existing Docker builds that rely on the local build context, such as dev.Dockerfile. It is recommended to adopt a more selective .dockerignore using an allowlist approach to protect sensitive data without disrupting other build processes.
| @@ -0,0 +1,2 @@ | |||
| # ignore everything | |||
| * | |||
There was a problem hiding this comment.
The current * in .dockerignore ignores all files, causing a denial of service for development and tooling build pipelines by breaking Dockerfiles like dev.Dockerfile, docker/bitcoind/Dockerfile, docker/btcd/Dockerfile, and tools/Dockerfile which rely on the build context. To prevent sensitive file leakage while maintaining build functionality, an allowlist approach is necessary. Please consider the suggested code_suggestion to allow only required files.
# ignore everything
*
# Allowlist files needed for other Dockerfiles
!docker/lnd/start-lnd.sh
!docker/bitcoind/start-bitcoind.sh
!docker/btcd/start-btcctl.sh
!docker/btcd/start-btcd.sh
!tools/
!lnrpc/
!make/
# Add other necessary source files for dev.Dockerfile if needed
#!.git/
#!*
Without this change, any files in the project directory will be copied into the Docker context when using "docker build". Note this includes git-ignored and dirty files like passwords, wallets, possibly git history, and so on. This uses quite a lot of disk space, causes unnecessary I/O and renders the Docker cache invalid even on the slightest change to the project. The current `Dockerfile` doesn't use the context at all, and `dev.Dockerfile` only needs a fraction of it. So we ignore everything that isn't explicitly allowed.
c40a8ab to
341581c
Compare
|
I force-pushed a new version that takes However I wasn't able to test the resulting output properly as I'm not an LND dev. So this should be reviewed carefully wether any important files are missing (and its non-existence silently ignored by the Makefile). |
How do I do that? I don't think I have permission to (re)request review. |
|
@schildbach, remember to re-request review from reviewers when ready |
Without this change, any files in the project directory will be copied into the Docker context when using "docker build". Note this includes git-ignored and dirty files like passwords, wallets, possibly git history, and so on.
This uses quite a lot of disk space, causes unnecessary I/O and renders the Docker cache invalid even on the slightest change to the project.
The current
Dockerfiledoesn't use the context at all, anddev.Dockerfileonly needs a fraction of it. So we ignore everything that isn't explicitly allowed.