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

fix(HMS-3914): harden dockerfile #187

Merged
merged 1 commit into from
Apr 30, 2024

Conversation

avisiedo
Copy link
Contributor

Add a policy to ignore by default from .dockerignore file. As .git is not copied, the printing out the last commit is made from the container-build rule. For internal CI/CD we can track the repository related state by the image tag which is the short hash of the repository.

Credits on: insights-rbac contributors

@avisiedo avisiedo self-assigned this Apr 10, 2024
@avisiedo avisiedo force-pushed the hms-3914-harden-dockerfile branch 3 times, most recently from ca6f9e7 to 135efc9 Compare April 11, 2024 07:36
@avisiedo avisiedo marked this pull request as ready for review April 11, 2024 08:14
@tiran
Copy link
Collaborator

tiran commented Apr 11, 2024

I fail to understand what problem this is solving. How can we ever leak credentials when the final container image only contains the binaries, migration scripts, and example config? AFAIK the intermediate build container will never ever leave the build machine.

Also we require the .git directory at build time to include VCS information in the binary. The RUN git log line is there to verify that the .git directory is available and accessible.

@avisiedo avisiedo force-pushed the hms-3914-harden-dockerfile branch 3 times, most recently from 39c08f9 to f4bdb53 Compare April 16, 2024 15:55
Add .docker .podman and .kube to the list of ignored
files for the build context of the container image.

Signed-off-by: Alejandro Visiedo <[email protected]>
Co-authored-by: Christian Heimes <[email protected]>
Copy link
Contributor

@pvoborni pvoborni left a comment

Choose a reason for hiding this comment

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

It looks OK, but don't know if it will break something. Going with the same way as in podengo-project/idmsvc-frontend#45 - let's merge this and revert if it breaks something.

@avisiedo avisiedo merged commit 2075bb1 into podengo-project:main Apr 30, 2024
1 check passed
@avisiedo avisiedo deleted the hms-3914-harden-dockerfile branch April 30, 2024 08:35
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.

3 participants