Skip to content

🐳 Refactor Dockerfile to decouple from Maven and enable CLI builds#723

Merged
aaronzi merged 2 commits intoeclipse-basyx:mainfrom
geso02:submodelservice-component-image
Apr 30, 2025
Merged

🐳 Refactor Dockerfile to decouple from Maven and enable CLI builds#723
aaronzi merged 2 commits intoeclipse-basyx:mainfrom
geso02:submodelservice-component-image

Conversation

@geso02
Copy link
Copy Markdown
Contributor

@geso02 geso02 commented Apr 30, 2025

📌 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 .

- 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
@geso02 geso02 requested a review from aaronzi April 30, 2025 12:07
@aaronzi aaronzi merged commit 1a54e0a into eclipse-basyx:main Apr 30, 2025
33 checks passed
@geso02 geso02 deleted the submodelservice-component-image branch May 6, 2025 06:00
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.

2 participants