You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Should we include .git, or is there a better way to not keep the whole .git directory in the docker image?
Hey there! If the only thing we need from .git/ and .github/ is the commit sha, I think we should avoid including the entire .git directory in the Docker image for only that. It's more secure (.git directory can sometimes contain sensitive information) or can just be large and affect the Docker image size unnecessarily.
The approach I'm proposing is to use a build-time environment variable to capture the commit hash during the Docker build process. Here's how it would work:
In our Dockerfile, we'll add a build argument to capture the commit hash:
Since we don't push the
.git
directory, we don't have access to the commit hash of the deployed app.react-webpack-rails-tutorial/.dockerignore
Lines 46 to 48 in 764a299
Should we include
.git
, or is there a better way to not keep the whole.git
directory in the docker image?The text was updated successfully, but these errors were encountered: