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

feat: remove project root from the docker image #1460

Merged
merged 4 commits into from
Jul 25, 2024

Conversation

ndr-brt
Copy link
Contributor

@ndr-brt ndr-brt commented Jul 25, 2024

WHAT

Avoid to put the whole content of the project into the docker image, aligning the actions image build process with the dockerize task.

WHY

optimization

FURTHER NOTES

further cleanups:

  • removed not-needed do_push parameter from the publish-docker-image action
  • cleaned up the downloadOtel task using a more "gradle-y" approach
  • add opentelemetry version on the version catalog, so it will be kept updated by dependabot
  • removed not necessary exclusion from the shadowJar config

Closes #1436

@ndr-brt ndr-brt added the enhancement New feature or request label Jul 25, 2024
@ndr-brt ndr-brt marked this pull request as ready for review July 25, 2024 09:57
Copy link

sonarcloud bot commented Jul 25, 2024

Copy link
Contributor

@paullatzelsperger paullatzelsperger left a comment

Choose a reason for hiding this comment

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

to be honest, I don't quite get the issue. The Dockerfile only copies the runtime JAR, the opentelemetry JAR and the additional files, i.e. legal docs?

build.gradle.kts Show resolved Hide resolved
@ndr-brt
Copy link
Contributor Author

ndr-brt commented Jul 25, 2024

to be honest, I don't quite get the issue. The Dockerfile only copies the runtime JAR, the opentelemetry JAR and the additional files, i.e. legal docs?

the root of the problem is that, if you don't specify the ADDITIONAL_FILES build-arg, it will copy everything in the context folder. So, only specifying that build-arg would fix the issue, the rest is cleanup to remove duplication and make everything more understandable.

you can try but checking the difference of the filesystem of the images built by these two commands:

# this will contain everything
docker build . -f edc-controlplane/edc-controlplane-postgresql-azure-vault/build/resources/docker/Dockerfile

# this will contain only what's needed
docker build edc-controlplane/edc-controlplane-postgresql-azure-vault -f edc-controlplane/edc-controlplane-postgresql-azure-vault/build/resources/docker/Dockerfile --build-arg "ADDITIONAL_FILES=build/legal/*"

@paullatzelsperger
Copy link
Contributor

paullatzelsperger commented Jul 25, 2024

the root of the problem is that, if you don't specify the ADDITIONAL_FILES build-arg, it will copy everything in the context folder.

yep, that is a problem indeed, but we should never have a docker build without ADDITIONAL_FILES, as the legal docs are mandated by EF? Wouldn't this make the problem theoretical in nature?

@ndr-brt
Copy link
Contributor Author

ndr-brt commented Jul 25, 2024

the root of the problem is that, if you don't specify the ADDITIONAL_FILES build-arg, it will copy everything in the context folder.

yep, that is a problem indeed, but we should never have a docker build without ADDITIONAL_FILES, as the legal docs are mandated by EF? Wouldn't this make the problem theoretical in nature?

if you look at the changelog, in the publish-docker-image it wasn't, so that line I added in the build-push-action job fixed the issue, then I did some refactor to make the dockerize task and the build-push-action call more similar to each other.

@ndr-brt ndr-brt merged commit 44585f6 into eclipse-tractusx:main Jul 25, 2024
34 checks passed
@ndr-brt ndr-brt deleted the 1436-cleanup-image branch July 25, 2024 12:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Status: Merged
Development

Successfully merging this pull request may close these issues.

published docker images contain all the project tree
2 participants