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

Directory .git is not ignored in Docker build #171

Open
RoBobik opened this issue Feb 6, 2024 · 0 comments
Open

Directory .git is not ignored in Docker build #171

RoBobik opened this issue Feb 6, 2024 · 0 comments

Comments

@RoBobik
Copy link
Contributor

RoBobik commented Feb 6, 2024

Directory .git is not excluded from the Docker build context.

Since the Dockerfile contains COPY . ., it also invalidates the build cache if you, for example, run git fetch (or your IDE does it for you in the background).

The .git dir cannot be simply added to .dockerignore because it is used in openidm-system/pom.xml for injecting branch name and commit id into org.forgerock.openidm.core.ServerConstants. When you try to do so anyway, the build fails on this error:

[ERROR] Failed to execute goal org.jboss.maven.plugins:maven-injection-plugin:1.0.2:bytecode (default) on project openidm-system: Execution default of goal org.jboss.maven.plugins:maven-injection-plugin:1.0.2:bytecode failed: Cannot invoke "String.length()" because "str" is null -> [Help 1]

See #116 in which the following change was introduced:

- <expression>${git.closest.tag.name}</expression>
+ <expression>${env.BUILD_TAG}</expression>

Perhaps we should take the other variables from build env as well (pass it from CI), or try to configure (if possible) a fallback for git-commit-id-plugin. Other alternatives may also be possible.

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

No branches or pull requests

1 participant