Skip to content

Commit aa987b1

Browse files
authored
Merge pull request #2 from project-construct-x/chore/boilerplate-issues
chore: added boilerplate for docker images
2 parents c614438 + 5d83b9b commit aa987b1

3 files changed

Lines changed: 108 additions & 1 deletion

File tree

launcher/con-x-wallet/Dockerfile

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,22 @@
1717
FROM eclipse-temurin:25-jre
1818
WORKDIR /app
1919

20+
ARG IMAGE_CREATED
21+
ARG VERSION_TAG
22+
23+
LABEL org.opencontainers.image.title="Construct-X Wallet" \
24+
org.opencontainers.image.description="Wallet-Service for Project Construct-X. It includes functionalities of both an identity-hub and an issuer-service." \
25+
org.opencontainers.image.url="https://github.com/project-construct-x/wallet" \
26+
org.opencontainers.image.source="https://github.com/project-construct-x/wallet" \
27+
org.opencontainers.image.version="${VERSION_TAG}" \
28+
org.opencontainers.image.licenses="Apache-2.0" \
29+
org.opencontainers.image.created="${IMAGE_CREATED}"
30+
2031
ARG JAR_FILE
2132
COPY build/libs/${JAR_FILE} /app/app.jar
2233

34+
COPY build/docker/runtimeClasspath-dependencies.txt /app/DEPENDENCIES
35+
COPY build/docker/LICENSE /app/LICENSE
36+
COPY NOTICE_DOCKER.md /app/NOTICE.md
37+
2338
ENTRYPOINT ["sh","-c","exec java -jar /app/app.jar --log-level=debug"]
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
# Notices for Construct-X Wallet
2+
3+
4+
This product includes software developed by the Project Construct-X and its contributors.
5+
The software is licensed under the Apache License, Version 2.0.
6+
You may obtain a copy of the License at:
7+
8+
https://www.apache.org/licenses/LICENSE-2.0
9+
10+
Unless required by applicable law or agreed to in writing, software
11+
distributed under the License is distributed on an "AS IS" BASIS,
12+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
14+
## Third-party Components
15+
16+
This product includes third-party components:
17+
18+
- Eclipse Dataspace Connector (EDC)
19+
Copyright (c) 2020-2026 Contributors to the Eclipse Foundation
20+
Licensed under the Apache License, Version 2.0
21+
See: https://github.com/eclipse-edc/Connector
22+
23+
- Eclipse IdentityHub
24+
Copyright (c) 2022-2026 Contributors to the Eclipse Foundation
25+
Licensed under the Apache License, Version 2.0
26+
See: https://github.com/eclipse-edc/IdentityHub
27+
28+
- super-user-seed-extension
29+
Copyright (c) 2026 Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V.
30+
Licensed under the Apache License, Version 2.0
31+
See: https://github.com/FraunhoferISST/super-user-seed-extension
32+
33+
- Eclipse Temurin (base container image)
34+
Provided by the Eclipse Adoptium project
35+
Licensed under the GNU General Public License, version 2 with the Classpath Exception
36+
See: https://adoptium.net
37+
38+
Additional third-party dependencies and their licenses are listed in the build configuration and in the dependency metadata, as shown in the `DEPENDENCIES` file.
39+
40+
**Used base image**
41+
42+
- [eclipse-temurin:25-jre](https://github.com/adoptium/containers)
43+
- Official Eclipse Temurin DockerHub page: https://hub.docker.com/_/eclipse-temurin
44+
- Eclipse Temurin Project: https://projects.eclipse.org/projects/adoptium.temurin
45+
- Additional information about the Eclipse Temurin images: https://github.com/docker-library/repo-info/tree/master/repos/eclipse-temurin
46+
47+
As with all Docker images, these likely also contain other software which may be under other licenses
48+
(such as Bash, etc. from the base distribution, along with any direct or indirect dependencies of the primary software being contained).
49+
50+
As for any pre-built image usage, it is the image user's responsibility to ensure that any use of this image complies with any relevant licenses for all software contained within.

launcher/con-x-wallet/build.gradle.kts

Lines changed: 43 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616

1717
import org.gradle.api.tasks.Exec
1818
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
19+
import java.time.Instant
1920

2021
plugins {
2122
`java-library`
@@ -52,13 +53,38 @@ tasks.shadowJar {
5253
manifest { attributes["Main-Class"] = application.mainClass.get() }
5354
}
5455

56+
val depsReportFile = layout.buildDirectory.file("docker/runtimeClasspath-dependencies.txt")
57+
58+
val generateRuntimeClasspathDeps = tasks.register("generateRuntimeClasspathDeps") {
59+
outputs.file(depsReportFile)
60+
61+
doLast {
62+
val conf = configurations.runtimeClasspath.get()
63+
64+
val outFile = depsReportFile.get().asFile
65+
outFile.parentFile.mkdirs()
66+
67+
outFile.printWriter().use { out ->
68+
out.println("runtimeClasspath dependencies:")
69+
conf.incoming.resolutionResult.allComponents.forEach { component ->
70+
val id = component.moduleVersion
71+
if (id != null) {
72+
out.println("${id.group}:${id.name}:${id.version}")
73+
} else {
74+
out.println(component.id.toString())
75+
}
76+
}
77+
}
78+
}
79+
}
80+
5581

5682
val imageName = "wallet:${releaseVersion}"
5783
val shadowJar = tasks.named<ShadowJar>("shadowJar")
5884
val jarFileName = "$releaseVersion.jar"
5985

6086
tasks.register<Exec>("dockerize") {
61-
dependsOn(shadowJar)
87+
dependsOn(shadowJar, generateRuntimeClasspathDeps)
6288

6389
workingDir = project.projectDir
6490

@@ -70,9 +96,25 @@ tasks.register<Exec>("dockerize") {
7096
require(jarFile.exists()) { "Shadow-Jar build/libs/$jarFileName missing " +
7197
"– please make sure \"shadowJar\" gradle task is successful" }
7298

99+
val depsFile = depsReportFile.get().asFile
100+
require(depsFile.exists()) {
101+
"Dependencies report ${depsFile.absolutePath} missing – check generateRuntimeClasspathDeps task"
102+
}
103+
104+
val dockerDir = project.layout.buildDirectory.dir("docker").get().asFile
105+
project.copy {
106+
from(rootProject.files("LICENSE"))
107+
into(dockerDir)
108+
}
109+
110+
111+
val imageCreated = Instant.now().toString()
112+
73113
commandLine(
74114
"docker", "build",
75115
"--build-arg", "JAR_FILE=$jarFileName",
116+
"--build-arg", "IMAGE_CREATED=$imageCreated",
117+
"--build-arg", "VERSION_TAG=$releaseVersion",
76118
"-t", imageName,
77119
"."
78120
)

0 commit comments

Comments
 (0)