Skip to content

Commit d68587e

Browse files
committed
Update version
1 parent 8863eaa commit d68587e

File tree

4 files changed

+49
-22
lines changed

4 files changed

+49
-22
lines changed

demo/integration-tests/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@
118118
<dependency>
119119
<groupId>software.xdev</groupId>
120120
<artifactId>testcontainers-advanced-imagebuilder</artifactId>
121-
<version>1.1.1</version>
121+
<version>2.0.1</version>
122122
</dependency>
123123
<dependency>
124124
<groupId>org.testcontainers</groupId>

demo/integration-tests/tci-webapp-rest/Dockerfile

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# syntax=docker/dockerfile:1-labs
12
# Note: This Dockerfile is used by the integration tests for compiling the app when there was no image was supplied
23
ARG JAVA_VERSION=21
34
FROM eclipse-temurin:${JAVA_VERSION}-jre-alpine AS jre-base
@@ -41,7 +42,18 @@ RUN apk add --no-cache git
4142

4243
WORKDIR /builder
4344

44-
# Copying is prepared by ITC
45+
# Copy & Cache wrapper
46+
COPY --parents mvnw .mvn/** ./
47+
RUN ./mvnw --version
48+
49+
# Copy & Cache poms/dependencies
50+
COPY --parents **/pom.xml ./
51+
# Resolve jars so that they can be cached and don't need to be downloaded when a Java file changes
52+
ARG MAVEN_GO_OFFLINE_COMMAND='./mvnw -B dependency:go-offline -pl demo/webapp-rest -am -Pprod,dev-log -DincludeScope=runtime -T2C'
53+
RUN echo "Executing '$MAVEN_GO_OFFLINE_COMMAND'"
54+
RUN ${MAVEN_GO_OFFLINE_COMMAND}
55+
56+
# Copying all other files
4557
COPY . ./
4658

4759
# A valid Git repo is required for the build
@@ -51,10 +63,10 @@ RUN git config --global user.email "[email protected]" \
5163
&& git add . \
5264
&& git commit -m "Init commit"
5365

54-
ARG mavenbuildcmd='./mvnw -B clean package -pl "demo/webapp-rest" -am -Pprod,dev-log -T2C -Dmaven.test.skip'
66+
ARG MAVEN_BUILD_COMMAND='./mvnw -B package -pl demo/webapp-rest -am -Pprod,dev-log -T2C -Dmaven.test.skip'
67+
RUN echo "Executing '$MAVEN_BUILD_COMMAND'"
68+
RUN ${MAVEN_BUILD_COMMAND}
5569

56-
RUN echo "Executing '$mavenbuildcmd'"
57-
RUN ${mavenbuildcmd}
5870
# See also https://docs.spring.io/spring-boot/reference/packaging/container-images/dockerfiles.html for further information
5971
RUN mv demo/webapp-rest/target/webapp-rest.jar app.jar \
6072
&& java -Djarmode=tools -jar app.jar extract --layers --destination extracted

demo/integration-tests/tci-webapp-vaadin/Dockerfile

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# syntax=docker/dockerfile:1-labs
12
# Note: This Dockerfile is used by the integration tests for compiling the app when there was no image was supplied
23
ARG JAVA_VERSION=21
34
FROM eclipse-temurin:${JAVA_VERSION}-jre-alpine AS jre-base
@@ -47,7 +48,18 @@ RUN node --version \
4748

4849
WORKDIR /builder
4950

50-
# Copying is prepared by ITC
51+
# Copy & Cache wrapper
52+
COPY --parents mvnw .mvn/** ./
53+
RUN ./mvnw --version
54+
55+
# Copy & Cache poms/dependencies
56+
COPY --parents **/pom.xml ./
57+
# Resolve jars so that they can be cached and don't need to be downloaded when a Java file changes
58+
ARG MAVEN_GO_OFFLINE_COMMAND='./mvnw -B dependency:go-offline -pl demo/webapp-vaadin -am -Pprod,dev-log -DincludeScope=runtime -T2C'
59+
RUN echo "Executing '$MAVEN_GO_OFFLINE_COMMAND'"
60+
RUN ${MAVEN_GO_OFFLINE_COMMAND}
61+
62+
# Copying all other files
5163
COPY . ./
5264

5365
# A valid Git repo is required for the build
@@ -57,10 +69,10 @@ RUN git config --global user.email "[email protected]" \
5769
&& git add . \
5870
&& git commit -m "Init commit"
5971

60-
ARG mavenbuildcmd='./mvnw -B clean package -pl "demo/webapp-vaadin" -am -Pprod,dev-log -T2C -Dmaven.test.skip'
72+
ARG MAVEN_BUILD_COMMAND='./mvnw -B package -pl demo/webapp-vaadin -am -Pprod,dev-log -T2C -Dmaven.test.skip'
73+
RUN echo "Executing '$MAVEN_BUILD_COMMAND'"
74+
RUN ${MAVEN_BUILD_COMMAND}
6175

62-
RUN echo "Executing '$mavenbuildcmd'"
63-
RUN ${mavenbuildcmd}
6476
# See also https://docs.spring.io/spring-boot/reference/packaging/container-images/dockerfiles.html for further information
6577
RUN mv demo/webapp-vaadin/target/webapp-vaadin.jar app.jar \
6678
&& java -Djarmode=tools -jar app.jar extract --layers --destination extracted

demo/integration-tests/tci-webapp/src/main/java/software/xdev/sse/demo/tci/webapp/containers/WebAppContainerBuilder.java

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
import org.slf4j.LoggerFactory;
99

1010
import software.xdev.testcontainers.imagebuilder.AdvancedImageFromDockerFile;
11+
import software.xdev.testcontainers.imagebuilder.compat.DockerfileCOPYParentsEmulator;
1112

1213

1314
@SuppressWarnings("PMD.MoreThanOneLogger")
@@ -35,30 +36,32 @@ public static synchronized String getBuiltImageName(final String module)
3536
final AdvancedImageFromDockerFile builder =
3637
new AdvancedImageFromDockerFile(module + "-local", false)
3738
.withLoggerForBuild(LOG_CONTAINER_BUILD)
38-
.withAdditionalIgnoreLines(
39+
.withPostGitIgnoreLines(
3940
// Ignore git-folder, as it will be provided in the Dockerfile
4041
".git/**",
4142
// Ignore other unused folders and extensions
42-
".iml",
43-
".md",
44-
"target/**",
43+
"*.iml",
44+
"*.cmd",
45+
"*.md",
4546
".config/**",
4647
".github/**",
4748
".idea/**",
4849
".run/**",
4950
"_dev_infra/**",
50-
"src/test/**",
51+
// Ignore other Dockerfiles (our required file will always be transferred)
52+
"Dockerfile",
5153
// Ignore not required test-modules that may have changed
5254
// sources only - otherwise the parent pom doesn't find the resources
53-
"tci-*/src/**",
54-
"webapp-it-base/src/**",
55-
"*-it/src/**",
55+
"demo/integration-tests/*/src/**",
56+
"**/src/test/**",
5657
// Ignore resources that are just used for development
57-
"webapp-rest/src/main/resources-dev/**")
58-
.withDockerFilePath(Paths.get("../" + module + "/Dockerfile"))
59-
.withBaseDir(Paths.get("../../"))
60-
// File is in root directory - we can't access it
61-
.withBaseDirRelativeIgnoreFile(null);
58+
"demo/webapp-rest/src/main/resources-dev/**",
59+
// Most files from these folders need to be ignored -> Down there for highest prio
60+
"node_modules",
61+
"target")
62+
.withDockerFilePath(Paths.get("../../../demo/integration-tests/" + module + "/Dockerfile"))
63+
.withBaseDir(Paths.get("../../../"))
64+
.withDockerFileLinesModifier(new DockerfileCOPYParentsEmulator());
6265

6366
try
6467
{

0 commit comments

Comments
 (0)