Skip to content

Commit

Permalink
Update container images to those that support the ARM architecture
Browse files Browse the repository at this point in the history
Signed-off-by: Kyle Aure <[email protected]>
  • Loading branch information
KyleAure committed Nov 14, 2023
1 parent 424d499 commit d5d1212
Show file tree
Hide file tree
Showing 17 changed files with 72 additions and 29 deletions.
2 changes: 1 addition & 1 deletion docs/features/SupportedRuntimes.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ Maven Dependency:
Example Dockerfile:

```
FROM jboss/wildfly
FROM quay.io/wildfly/wildfly:30.0.0.Final-jdk11
ADD build/libs/myservice.war /opt/jboss/wildfly/standalone/deployments/
```

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2019 Payara Services Corporation and others
* Copyright (c) 2019, 2023 Payara Services Corporation and others
*
* See the NOTICE file(s) distributed with this work for additional
* information regarding copyright ownership.
Expand Down Expand Up @@ -48,6 +48,8 @@ public ImageFromDockerfile getDefaultImage(File appFile) {
// FROM payara/micro:5.2022.5-jdk11
// CMD ["--deploymentDir", "/opt/payara/deployments", "--noCluster"]
// ADD target/myservice.war /opt/payara/deployments/
//FIXME - update to newer payara version once multi-platform docker images are available
//See issue: https://github.com/payara/Payara/issues/5715
ImageFromDockerfile image = new ImageFromDockerfile()
.withDockerfileFromBuilder(builder -> builder.from("payara/micro:5.2022.5-jdk11")
.cmd("--deploymentDir", "/opt/payara/deployments/", "--noCluster")
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2019 Payara Services Corporation and others
* Copyright (c) 2019, 2023 Payara Services Corporation and others
*
* See the NOTICE file(s) distributed with this work for additional
* information regarding copyright ownership.
Expand Down Expand Up @@ -47,6 +47,8 @@ public ImageFromDockerfile getDefaultImage(File appFile) {
// Compose a docker image equivalent to doing:
// FROM payara/server-full:5.2022.5-jdk11
// ADD target/myservice.war /opt/payara/deployments/
//FIXME - update to newer payara version once multi-platform docker images are available
//See issue: https://github.com/payara/Payara/issues/5715
ImageFromDockerfile image = new ImageFromDockerfile()
.withDockerfileFromBuilder(builder -> builder.from("payara/server-full:5.2022.5-jdk11")
.add(appName, "/opt/payara/deployments/")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
import org.microshed.testing.testcontainers.ApplicationContainer;
import org.testcontainers.containers.MockServerContainer;
import org.testcontainers.junit.jupiter.Container;
import org.testcontainers.utility.DockerImageName;

@MicroShedTest
public class TestcontainersConfigurationIT {
Expand All @@ -46,8 +47,12 @@ public class TestcontainersConfigurationIT {
.withEnv("SVC_URL6", oldValue -> "http://mockserver:1080")
.withMpRestClient("com.foo.ExampleClass", "http://mockserver:1080");

private static final DockerImageName MOCK_SERVER_IMAGE_NAME =
DockerImageName.parse("mockserver/mockserver:5.15.0")
.asCompatibleSubstituteFor("jamesdbloom/mockserver");

@Container
public static MockServerContainer mockServer = new MockServerContainer()
public static MockServerContainer mockServer = new MockServerContainer(MOCK_SERVER_IMAGE_NAME)
.withNetworkAliases("mockserver")
.withEnv("STAYS_UNCHANGED", "mockserver");

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2019 IBM Corporation and others
* Copyright (c) 2019, 2023 IBM Corporation and others
*
* See the NOTICE file(s) distributed with this work for additional
* information regarding copyright ownership.
Expand All @@ -20,6 +20,7 @@

import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertThrows;
import static org.junit.jupiter.api.Assertions.assertTrue;

import java.util.Arrays;
import java.util.Map;
Expand Down Expand Up @@ -95,22 +96,26 @@ public void testPrimaryPort() {
ApplicationContainer app = dummyApp()
.withHttpPort(8888)
.withExposedPorts(7777, 9999);
assertEquals(Arrays.asList(8888, 7777, 9999), app.getExposedPorts());
assertEquals(8888, app.getFirstMappedPort());
assertTrue(app.getExposedPorts().containsAll(Arrays.asList(8888, 7777, 9999)));

app = dummyApp()
.withExposedPorts(1234, 1235)
.withHttpPort(4444);
assertEquals(Arrays.asList(4444, 1234, 1235), app.getExposedPorts());
assertEquals(4444, app.getFirstMappedPort());
assertTrue(app.getExposedPorts().containsAll(Arrays.asList(4444, 1234, 1235)));

app = dummyApp();
app.withHttpPort(5555);
app.setExposedPorts(Arrays.asList(1238, 1239));
assertEquals(Arrays.asList(5555, 1238, 1239), app.getExposedPorts());
assertEquals(5555, app.getFirstMappedPort());
assertTrue(app.getExposedPorts().containsAll(Arrays.asList(5555, 1238, 1239)));

app = dummyApp()
.withHttpPort(9081)
.withExposedPorts(9081, 9444);
assertEquals(Arrays.asList(9081, 9444), app.getExposedPorts());
assertEquals(9081, app.getFirstMappedPort());
assertTrue(app.getExposedPorts().containsAll(Arrays.asList(9081, 9444)));
}

public static ApplicationContainer dummyApp() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
import org.testcontainers.containers.wait.strategy.WaitStrategy;
import org.testcontainers.containers.wait.strategy.WaitStrategyTarget;
import org.testcontainers.junit.jupiter.Container;
import org.testcontainers.utility.DockerImageName;

@MicroShedTest
public class HollowTestcontainersConfigurationTest {
Expand Down Expand Up @@ -63,8 +64,12 @@ public void waitUntilReady(WaitStrategyTarget waitStrategyTarget) {
}
});

private static final DockerImageName MOCK_SERVER_IMAGE_NAME =
DockerImageName.parse("mockserver/mockserver:5.15.0")
.asCompatibleSubstituteFor("jamesdbloom/mockserver");

@Container
public static MockServerContainer mockServer = new MockServerContainer()
public static MockServerContainer mockServer = new MockServerContainer(MOCK_SERVER_IMAGE_NAME)
.withNetworkAliases("mockserver")
.withEnv("STAYS_UNCHANGED", "mockserver");

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2020 Philip Riecks
* Copyright (c) 2020, 2023 Philip Riecks
*
* See the NOTICE file(s) distributed with this work for additional
* information regarding copyright ownership.
Expand Down Expand Up @@ -44,14 +44,14 @@ public int getDefaultHttpsPort() {
public ImageFromDockerfile getDefaultImage(File appFile) {
String appName = appFile.getName();
// Compose a docker image equivalent to doing:
// FROM jboss/wildfly:18.0.1.Final
// FROM quay.io/wildfly/wildfly:30.0.0.Final-jdk11
// ADD target/myservice.war /opt/jboss/wildfly/standalone/deployments/
ImageFromDockerfile image = new ImageFromDockerfile()
.withDockerfileFromBuilder(builder -> builder.from("jboss/wildfly:18.0.1.Final")
.withDockerfileFromBuilder(builder -> builder
.from("quay.io/wildfly/wildfly:30.0.0.Final-jdk11")
.add(appName, "/opt/jboss/wildfly/standalone/deployments/")
.build())
.withFileFromFile(appName, appFile);
return image;

}
}
2 changes: 1 addition & 1 deletion sample-apps/everything-app/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ COPY src/main/liberty/config /config/
ADD build/libs/myservice.war /config/dropins/

# Wildfly
#FROM jboss/wildfly
#FROM quay.io/wildfly/wildfly:30.0.0.Final-jdk11
#ADD build/libs/myservice.war /opt/jboss/wildfly/standalone/deployments/

# Payara
Expand Down
12 changes: 8 additions & 4 deletions sample-apps/everything-app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,17 @@ plugins {
dependencies {
providedCompile 'javax:javaee-api:8.0.1'
providedCompile 'org.eclipse.microprofile:microprofile:2.1'
compile group: 'org.mongodb', name: 'mongo-java-driver', version: '3.11.2'

compile 'org.mongodb:mongo-java-driver:3.11.2'

testCompile project(':microshed-testing-testcontainers')
testCompile project(':microshed-testing-core')
testCompile group: 'org.slf4j', name: 'slf4j-log4j12', version: '1.7.36'

testCompile 'org.slf4j:slf4j-log4j12:1.7.36'
testCompile 'org.testcontainers:mockserver:1.19.1'
testCompile 'org.mock-server:mockserver-client-java:5.5.4'
testCompile 'io.rest-assured:rest-assured:4.5.1'
testCompile 'org.mock-server:mockserver-client-java:5.15.0'
testCompile 'io.rest-assured:rest-assured:5.3.2'

testImplementation 'org.junit.jupiter:junit-jupiter:5.10.1'
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import org.testcontainers.containers.GenericContainer;
import org.testcontainers.containers.MockServerContainer;
import org.testcontainers.junit.jupiter.Container;
import org.testcontainers.utility.DockerImageName;

public class AppContainerConfig implements SharedContainerConfiguration {

Expand All @@ -33,8 +34,12 @@ public class AppContainerConfig implements SharedContainerConfiguration {
.withEnv("MONGO_PORT", "27017")
.withMpRestClient(ExternalRestServiceClient.class, "http://mockserver:" + MockServerContainer.PORT);

private static final DockerImageName MOCK_SERVER_IMAGE_NAME =
DockerImageName.parse("mockserver/mockserver:5.15.0")
.asCompatibleSubstituteFor("jamesdbloom/mockserver");

@Container
public static MockServerContainer mockServer = new MockServerContainer()
public static MockServerContainer mockServer = new MockServerContainer(MOCK_SERVER_IMAGE_NAME)
.withNetworkAliases("mockserver");

@Container
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,7 @@
import org.microshed.testing.jaxrs.RESTClient;
import org.microshed.testing.jupiter.MicroShedTest;
import org.mockserver.client.MockServerClient;

import com.google.common.net.MediaType;
import org.mockserver.model.MediaType;

@SuppressWarnings("resource")

Expand Down
2 changes: 1 addition & 1 deletion sample-apps/everything-jakarta-app/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ COPY src/main/liberty/config /config/
ADD build/libs/myservice.war /config/dropins/

# Wildfly
#FROM jboss/wildfly
#FROM quay.io/wildfly/wildfly:30.0.0.Final-jdk11
#ADD build/libs/myservice.war /opt/jboss/wildfly/standalone/deployments/

# Payara
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,12 @@ public class AppContainerConfig implements SharedContainerConfiguration {
.withEnv("MONGO_PORT", "27017")
.withMpRestClient(ExternalRestServiceClient.class, "http://mockserver:" + MockServerContainer.PORT);

private static DockerImageName mockServerImage = DockerImageName.parse("mockserver/mockserver:5.15.0").asCompatibleSubstituteFor("jamesdbloom/mockserver");
private static final DockerImageName MOCK_SERVER_IMAGE_NAME =
DockerImageName.parse("mockserver/mockserver:5.15.0")
.asCompatibleSubstituteFor("jamesdbloom/mockserver");

@Container
public static MockServerContainer mockServer = new MockServerContainer(mockServerImage)
public static MockServerContainer mockServer = new MockServerContainer(MOCK_SERVER_IMAGE_NAME)
.withNetworkAliases("mockserver");

@Container
Expand Down
6 changes: 5 additions & 1 deletion sample-apps/kafka-app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,16 @@ dependencies {
providedCompile 'javax:javaee-api:8.0.1'
providedCompile 'org.eclipse.microprofile:microprofile:3.3'
providedCompile 'org.eclipse.microprofile.reactive.messaging:microprofile-reactive-messaging-api:1.0'
compile 'org.apache.kafka:kafka-clients:2.4.0'

compile 'org.apache.kafka:kafka-clients:3.6.0'

testCompile project(':microshed-testing-testcontainers')
testCompile project(':microshed-testing-core')

testCompile 'org.awaitility:awaitility:4.0.2'
testCompile 'org.testcontainers:kafka:1.15.0'
testCompile 'org.slf4j:slf4j-log4j12:1.7.36'

testImplementation 'org.junit.jupiter:junit-jupiter:5.10.1'
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2020 IBM Corporation and others
* Copyright (c) 2020, 2023 IBM Corporation and others
*
* See the NOTICE file(s) distributed with this work for additional
* information regarding copyright ownership.
Expand All @@ -23,13 +23,17 @@
import org.testcontainers.containers.KafkaContainer;
import org.testcontainers.containers.Network;
import org.testcontainers.junit.jupiter.Container;
import org.testcontainers.utility.DockerImageName;

public class AppContainerConfig implements SharedContainerConfiguration {

private static Network network = Network.newNetwork();

private static final DockerImageName KAFKA_IMAGE_NAME =
DockerImageName.parse("confluentinc/cp-kafka:7.4.3");

@Container
public static KafkaContainer kafka = new KafkaContainer()
public static KafkaContainer kafka = new KafkaContainer(KAFKA_IMAGE_NAME)
.withNetworkAliases("kafka")
.withNetwork(network);

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2019 IBM Corporation and others
* Copyright (c) 2019, 2023 IBM Corporation and others
*
* See the NOTICE file(s) distributed with this work for additional
* information regarding copyright ownership.
Expand Down Expand Up @@ -30,12 +30,15 @@
import javax.ws.rs.ProcessingException;

import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.condition.DisabledIfSystemProperty;
import org.microshed.testing.jaxrs.RESTClient;
import org.microshed.testing.jupiter.MicroShedTest;
import org.microshed.testing.testcontainers.ApplicationContainer;
import org.testcontainers.junit.jupiter.Container;

@MicroShedTest
//FIXME - re-enable arm testing when payara releases multi-platform images
@DisabledIfSystemProperty(named = "os.arch", matches = ".*aarch64.*")
public class PayaraIT {

@Container
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@
@MicroShedTest
public class WildFlyIT {

//FIXME - container is failing to start with
// Timed out waiting for URL to be accessible (http://127.0.0.1:32956/myservice/app/people should return HTTP 200)
// java.lang.RuntimeException: HTTP response code was: 404
@Container
public static ApplicationContainer app = new ApplicationContainer()
.withAppContextRoot("/myservice")
Expand Down

0 comments on commit d5d1212

Please sign in to comment.