🐳 Refactor Dockerfile to decouple from Maven and enable CLI builds#723
Merged
aaronzi merged 2 commits intoeclipse-basyx:mainfrom Apr 30, 2025
Merged
Conversation
- Dockerfile now uses a multi-stage build to download the aas4j-model (version 1.0.4) directly from Maven Central - Removed dependency on Maven build output for external libraries - Image can now be built using only `docker build`, without requiring Maven for dependency resolution - Updated GitHub workflow to include Docker image build step
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
📌 Summary
This PR refactors the Dockerfile to:
Use a multi-stage build to fetch the aas4j-model (version 1.0.4) directly from Maven Central using the Maven CLI.
Remove the dependency on Maven’s build output for external JARs.
Allow the Docker image to be built solely via docker build or docker buildx, without needing the Maven lifecycle for downloading dependencies.
🔄 Changes
Added a new first stage to the Dockerfile using the maven:3.9-eclipse-temurin-17 base image to download the AAS4J JAR.
Copied the downloaded JAR from that stage into the final runtime image.
Updated the GitHub Actions workflow to build the Docker image as part of the CI process.
✅ Benefits
Developers can now build the Docker image without relying on Maven or the target/libs output.
Simplifies the CI/CD process.
Keeps external dependency management within the Docker build context.
🛠 Build Example
mvn clean package
docker build --build-arg AAS4J_VERSION=1.0.4 -t my-app .