diff --git a/dev/build.example.testcontainers_fat/fat/src/com/ibm/ws/testcontainers/example/ProgrammaticImageTest.java b/dev/build.example.testcontainers_fat/fat/src/com/ibm/ws/testcontainers/example/ProgrammaticImageTest.java index 00322b162ce8..25d946e7f0c8 100644 --- a/dev/build.example.testcontainers_fat/fat/src/com/ibm/ws/testcontainers/example/ProgrammaticImageTest.java +++ b/dev/build.example.testcontainers_fat/fat/src/com/ibm/ws/testcontainers/example/ProgrammaticImageTest.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2021, 2024 IBM Corporation and others. + * Copyright (c) 2021, 2025 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at @@ -91,7 +91,7 @@ public class ProgrammaticImageTest { new ImageFromDockerfile().withDockerfileFromBuilder(builder -> builder.from(postgresql.asCanonicalNameString())// .copy("/docker-entrypoint-initdb.d/initDB.sql", "/docker-entrypoint-initdb.d/initDB.sql") .build()) - .withFileFromFile("/docker-entrypoint-initdb.d/initDB.sql", new File("lib/LibertyFATTestFiles/postgres/scripts/initDB.sql"), 644)) + .withFileFromFile("/docker-entrypoint-initdb.d/initDB.sql", new File("lib/LibertyFATTestFiles/postgres/initDB.sql"), 644)) .withExposedPorts(POSTGRE_PORT) .withEnv("POSTGRES_DB", POSTGRES_DB) .withEnv("POSTGRES_USER", POSTGRES_USER) diff --git a/dev/build.example.testcontainers_fat/publish/files/postgres/Dockerfile b/dev/build.example.testcontainers_fat/publish/files/postgres/Dockerfile deleted file mode 100644 index 197c55e54c6f..000000000000 --- a/dev/build.example.testcontainers_fat/publish/files/postgres/Dockerfile +++ /dev/null @@ -1,10 +0,0 @@ -# TODO update to public.ecr.aws/docker/library/postgres:17.0-alpine - -FROM postgres:14.1-alpine - -COPY scripts/initDB.sql /docker-entrypoint-initdb.d/initDB.sql - -RUN chown postgres /docker-entrypoint-initdb.d/initDB.sql && chmod 600 /docker-entrypoint-initdb.d/initDB.sql - - -# Currently tagged in DockerHub as: kyleaure/postgres-test-table:3.0 diff --git a/dev/build.example.testcontainers_fat/publish/files/postgres/initDB.sql b/dev/build.example.testcontainers_fat/publish/files/postgres/initDB.sql new file mode 100644 index 000000000000..d9bbc96fca03 --- /dev/null +++ b/dev/build.example.testcontainers_fat/publish/files/postgres/initDB.sql @@ -0,0 +1,12 @@ +DROP TABLE IF EXISTS testtable; + +-- Create table +CREATE TABLE testtable ( + PersonID int, + LastName varchar(255), + FirstName varchar(255), + City varchar(255) +); + +-- Insert test data +INSERT INTO testtable (PersonID, LastName, FirstName, City) VALUES (1, 'Doe', 'John', 'Rochester'); \ No newline at end of file diff --git a/dev/build.example.testcontainers_fat/publish/files/postgres/release.sh b/dev/build.example.testcontainers_fat/publish/files/postgres/release.sh deleted file mode 100755 index 7af095d0aa95..000000000000 --- a/dev/build.example.testcontainers_fat/publish/files/postgres/release.sh +++ /dev/null @@ -1,32 +0,0 @@ -#!/bin/bash -#Sample script to make it easier to push custom images to dockerhub - -#TODO needs to be provided by user -USER_NAME=kyleaure - -#TODO need to provide version of docker image. Increment if doing a new release -VERSION=3.0 - -#TODO need to provide name of the final image -IMAGE_NAME=postgres-test-table - -#Docker image signiture in form username/image:version -SIGNITURE=$USER_NAME/$IMAGE_NAME:$VERSION - -echo "Attempting to build and push $SIGNITURE" - -#Ensure user is logged in -docker login || (echo "Unable to login to DockerHub" && exit 1) - -#This script assumes it is in the same directory as the Dockerfile -docker build -t "$SIGNITURE" . - -#Push image to DockerHub -docker push "$SIGNITURE" - -#Add a comment to the Dockerfile and script -sed -i '' -e '/.*Currently tagged in DockerHub as.*/d' *Dockerfile -cat << EOF >> *Dockerfile - -# Currently tagged in DockerHub as: $SIGNITURE -EOF diff --git a/dev/com.ibm.ws.cloudant_fat/publish/files/couchdb-ssl/Dockerfile b/dev/com.ibm.ws.cloudant_fat/publish/files/couchdb-ssl/Dockerfile deleted file mode 100644 index b16564330887..000000000000 --- a/dev/com.ibm.ws.cloudant_fat/publish/files/couchdb-ssl/Dockerfile +++ /dev/null @@ -1,9 +0,0 @@ -FROM couchdb:3.2.0 - -COPY couchdb-config/testcontainers_config.ini /opt/couchdb/etc/local.d/ -COPY ssl-certs/couchdb.pem /etc/couchdb/cert/ -COPY ssl-certs/privkey.pem /etc/couchdb/cert/ - -RUN chmod 644 /etc/couchdb/cert/* - -# Currently tagged in DockerHub as: kyleaure/couchdb-ssl:1.0 diff --git a/dev/com.ibm.ws.cloudant_fat/publish/files/couchdb-ssl/release.sh b/dev/com.ibm.ws.cloudant_fat/publish/files/couchdb-ssl/release.sh deleted file mode 100755 index 05c0d00162cd..000000000000 --- a/dev/com.ibm.ws.cloudant_fat/publish/files/couchdb-ssl/release.sh +++ /dev/null @@ -1,30 +0,0 @@ -#!/bin/bash - -#Needs to be provided by user -USER_NAME=kyleaure - -#Version of docker image. Increment if doing a new release -VERSION=1.0 - -#Name of the final image -IMAGE_NAME=couchdb-ssl - -#Docker image signiture in form username/image:version -SIGNITURE=$USER_NAME/$IMAGE_NAME:$VERSION - -echo "Attempting to build and push $SIGNITURE" - -#Ensure user is logged in -docker login || (echo "Unable to login to DockerHub" && exit 1) - -#This script assumes it is in the same directory as the Dockerfile -docker build --no-cache -t $SIGNITURE . - -#Push image to DockerHub -docker push "$SIGNITURE" - -#Add a comment to the Dockerfile and script -sed -i '' -e '/.*Currently tagged in DockerHub as.*/d' *Dockerfile -cat << EOF >> *Dockerfile -# Currently tagged in DockerHub as: $SIGNITURE -EOF \ No newline at end of file diff --git a/dev/com.ibm.ws.install.featureUtility_fat/fat/src/com/ibm/ws/install/featureUtility/fat/InstallFeatureTest.java b/dev/com.ibm.ws.install.featureUtility_fat/fat/src/com/ibm/ws/install/featureUtility/fat/InstallFeatureTest.java index c0bc37b1342b..f71f13d0b753 100644 --- a/dev/com.ibm.ws.install.featureUtility_fat/fat/src/com/ibm/ws/install/featureUtility/fat/InstallFeatureTest.java +++ b/dev/com.ibm.ws.install.featureUtility_fat/fat/src/com/ibm/ws/install/featureUtility/fat/InstallFeatureTest.java @@ -53,6 +53,7 @@ public class InstallFeatureTest extends FeatureUtilityToolTest { * "Started Sonatype Nexus.*" to make sure repository is up and running. * Disabling due to intermittent time out */ + // TODO publish Dockerfile for this custom image // public static GenericContainer nexusContainer = new GenericContainer<>("jiwoo/nexus:1.0") // .withStartupTimeout(Duration.of(5, ChronoUnit.MINUTES)) // .waitingFor(Wait.forLogMessage("Started Sonatype Nexus.*", 1)) @@ -65,6 +66,7 @@ public class InstallFeatureTest extends FeatureUtilityToolTest { .withLogConsumer(new SimpleLogConsumer(InstallFeatureTest.class, "keyserver")).withNetwork(network) .withNetworkAliases("keyserver"); + //TODO publish Dockerfile for this custom image @ClassRule public static GenericContainer proxyContainer = new GenericContainer<>("jiwoo/squid-proxy:1.0") .withExposedPorts(3128).withNetwork(network); diff --git a/dev/com.ibm.ws.install.featureUtility_fat/publish/simple-keyserver/Dockerfile b/dev/com.ibm.ws.install.featureUtility_fat/publish/simple-keyserver/Dockerfile deleted file mode 100644 index 524fa54d8219..000000000000 --- a/dev/com.ibm.ws.install.featureUtility_fat/publish/simple-keyserver/Dockerfile +++ /dev/null @@ -1,27 +0,0 @@ -FROM python:3-alpine - -RUN mkdir /public_key - -WORKDIR /public_key - -RUN printf '\ ------BEGIN PGP PUBLIC KEY BLOCK-----\n\ -Comment: Hostname: \n\ -Version: Hockeypuck 2.1.0-222-g25248d4\n\ -\n\ -xjMEY+1Y6RYJKwYBBAHaRw8BAQdAzgcyMvreUdoUXYofjC+mCm1dW9IaPs+nx9rF\n\ -dc4mKFLOOARj7VjpEgorBgEEAZdVAQUBAQdA52rgXKV5cdmIqXhIhUvT/Hvktcyy\n\ -kKdqt/YJX5GY1CYDAQgHwngEGBYKACACGwwWIQQQyeYjPrW9z8ApyzBx+OYjm2g0\n\ -qgUCY+1ZowAKCRBx+OYjm2g0qtuIAQD64SWKyMBtvr8TZT91mIAsMV+npF58B3v0\n\ -tNyeDipYJQEA74mtwWh9R7i7+7b3jsxFEMSzu8ZbTk25qSIlQLmE9wM=\n\ -=G+gC\n\ ------END PGP PUBLIC KEY BLOCK-----\n\ -' > "/public_key/validKey.asc" - -EXPOSE 8080 - - - -CMD ["python", "-m" , "http.server", "8080"] - -# Currently tagged in DockerHub as: jiwoo/simple-keyserver:1.0 diff --git a/dev/com.ibm.ws.install.featureUtility_fat/publish/simple-keyserver/release.sh b/dev/com.ibm.ws.install.featureUtility_fat/publish/simple-keyserver/release.sh deleted file mode 100755 index 40d9b3940b15..000000000000 --- a/dev/com.ibm.ws.install.featureUtility_fat/publish/simple-keyserver/release.sh +++ /dev/null @@ -1,32 +0,0 @@ -#!/bin/bash - -#Needs to be provided by user -USER_NAME=jiwoo - -#Version of docker image. Increment if doing a new release -VERSION=1.0 - -#Name of the image -IMAGE_NAME=simple-keyserver - -#Docker image signiture in form username/image:version -CONTAINER=$USER_NAME/$IMAGE_NAME:$VERSION - -echo "Attempting to build and push $CONTAINER" - -#Ensure user is logged in -docker login || (echo "Unable to login to DockerHub" && exit 1) - -#This script assumes it is in the same directory as the Dockerfile -docker build --no-cache -t $CONTAINER . - - -#Push image to DockerHub -docker push "$CONTAINER" - -#Add a comment to the Dockerfile and script -sed -i '' -e '/.*Currently tagged in DockerHub as.*/d' *Dockerfile -cat << EOF >> *Dockerfile - -# Currently tagged in DockerHub as: $CONTAINER -EOF diff --git a/dev/com.ibm.ws.jdbc_fat_db2/fat/src/com/ibm/ws/jdbc/fat/db2/DB2Test.java b/dev/com.ibm.ws.jdbc_fat_db2/fat/src/com/ibm/ws/jdbc/fat/db2/DB2Test.java index 31ad165e5656..bd0256ec1978 100644 --- a/dev/com.ibm.ws.jdbc_fat_db2/fat/src/com/ibm/ws/jdbc/fat/db2/DB2Test.java +++ b/dev/com.ibm.ws.jdbc_fat_db2/fat/src/com/ibm/ws/jdbc/fat/db2/DB2Test.java @@ -59,6 +59,15 @@ public static void setUp() throws Exception { server.addEnvVar("DB2_USER", db2.getUsername()); server.addEnvVar("DB2_PASS", db2.getPassword()); + // TODO extract security files from container prior to server start + // TODO delete security files from git + + // Extract keystore from container +// db2.copyFileFromContainer("/certs/db2-keystore.p12", server.getServerRoot() + "/security/db2-keystore.p12"); + + // Extract server cert from container +// db2.copyFileFromContainer("/certs/server.arm", server.getServerRoot() + "/security/server.crt"); + server.startServer(); runTest(server, APP_NAME + '/' + SERVLET_NAME, "initDatabase"); diff --git a/dev/com.ibm.ws.jdbc_fat_db2/publish/files/db2-ssl/release.sh b/dev/com.ibm.ws.jdbc_fat_db2/publish/files/db2-ssl/release.sh deleted file mode 100755 index fa2d0806b3ea..000000000000 --- a/dev/com.ibm.ws.jdbc_fat_db2/publish/files/db2-ssl/release.sh +++ /dev/null @@ -1,76 +0,0 @@ -#!/bin/bash - -#Needs to be provided by user -USER_NAME=kyleaure - -#Version of docker image. Increment if doing a new release -VERSION=3.0 - -#Name of the final image -IMAGE_NAME=db2-ssl - -#Docker image signature in form username/image:version -SIGNATURE=$USER_NAME/$IMAGE_NAME:$VERSION - -echo "Attempting to build and push $SIGNATURE" - -#Ensure user is logged in -docker login || (echo "Unable to login to DockerHub" && exit 1) - -#This script assumes it is in the same directory as the Dockerfile -docker build -t $SIGNATURE . - -SECURITY_DIR=../../servers/com.ibm.ws.jdbc.fat.db2/security/ -CONTAINER="TMP-CONTAINER" - -rm -rf $SECURITY_DIR -mkdir -p $SECURITY_DIR - -echo "-------------------------- Extract keystore --------------------------" -docker create --name $CONTAINER $SIGNATURE -docker cp $CONTAINER:/certs/db2-keystore.p12 $SECURITY_DIR -docker rm $CONTAINER - -keytool -list -v -keystore $SECURITY_DIR/db2-keystore.p12 -storepass db2test -storetype PKCS12 - -echo "-------------------------- Extract server cert ------------------------" -docker create --name $CONTAINER $SIGNATURE -docker cp $CONTAINER:/certs/server.arm $SECURITY_DIR/server.crt -docker rm $CONTAINER - -cat $SECURITY_DIR/server.crt - -echo "-------------------------- Generate wrong cert ------------------------" -### Same certificate used by our PostgreSQL SSL tests (which is invalid for DB2) ### -touch $SECURITY_DIR/wrong.crt -cat <> $SECURITY_DIR/wrong.crt ------BEGIN CERTIFICATE----- -MIIC+zCCAeOgAwIBAgIJALOwwUU1kHLrMA0GCSqGSIb3DQEBCwUAMBQxEjAQBgNV -BAMMCWxvY2FsaG9zdDAeFw0xOTA1MjExNTAzNDdaFw0xOTA2MjAxNTAzNDdaMBQx -EjAQBgNVBAMMCWxvY2FsaG9zdDCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoC -ggEBAKfa9xN63c12+tG69cj8oOY10ksB0IAoDjUhNXGU/IEDJKsS0yVHag9OBBO4 -LF0m1fiUkdvIpveLaLVvyOSxQ9C3aRkGyz8YoSxe6wHOnZx3bB62C/Juz+FReWnh -0QX0op6fbChIP99mEYyL6vIjUnH1dMHsrS2nOpFyIRwtuLyJqJGOaq2aNleVsS0t -dCSb8MszbZ+ARvC/GklER9kZdTvdTTeJprzl2UfkeCFgla48vc0yiuM5eLAy+h6M -P8mUC+UJwX/zoHhDBjyjlUNApy6de4QcHWapIQVFlfGO8oOWZs3e+3nGwLLpT7a1 -7ulTqHu4i7DZ0osWgdqt9bv08qUCAwEAAaNQME4wHQYDVR0OBBYEFDdafw0OVsi5 -xSgntDwILWhFvcABMB8GA1UdIwQYMBaAFDdafw0OVsi5xSgntDwILWhFvcABMAwG -A1UdEwQFMAMBAf8wDQYJKoZIhvcNAQELBQADggEBAARud5FsEtdC8E1mCphgtzsc -eIvNLEwNN3xqvFQlm/JwjlzZBnp0zdsKhMh7FME+W6fiIExjsd18Uk8MTb8XRyEQ -cKLbc7XFD3YDux3NELexp1LWMIpBdWXORiy0K625Y/qs1K26BYmYFz1eWXmEj4vY -FnQ8cURQYeVOTM2pFCG8GjCVPk4IdB8aiElEbNiI3jaOH777Vk5VymLxi9tqfCu/ -xDJmkxIcC3C3PPIBn8mEPpqoyxgI8gVWP85Zdyyb0ZoEYFUcvv5QknR1Om/julGM -HAW8+C7+TzU+tVxEUze6b+3UFVhTm6YeDMR9Ifbaix2EruVz9wZt9xOOXLf3W5c= ------END CERTIFICATE----- -EOF - -cat $SECURITY_DIR/wrong.crt - -#Push image to DockerHub -docker push "$SIGNATURE" - -#Add a comment to the Dockerfile and script -sed -i '' -e '/.*Currently tagged in DockerHub as.*/d' *Dockerfile -cat <> *Dockerfile -# Currently tagged in DockerHub as: $SIGNATURE -EOF \ No newline at end of file diff --git a/dev/com.ibm.ws.jdbc_fat_krb5/publish/files/db2/release.sh b/dev/com.ibm.ws.jdbc_fat_krb5/publish/files/db2/release.sh deleted file mode 100755 index f7ac60174764..000000000000 --- a/dev/com.ibm.ws.jdbc_fat_krb5/publish/files/db2/release.sh +++ /dev/null @@ -1,31 +0,0 @@ -#!/bin/bash - -#Needs to be provided by user -USER_NAME=kyleaure - -#Version of docker image. Increment if doing a new release -VERSION=2.0 - -#Name of the final image -IMAGE_NAME=db2-krb5 - -#Docker image signiture in form username/image:version -SIGNATURE=$USER_NAME/$IMAGE_NAME:$VERSION - -echo "Attempting to build and push $SIGNATURE" - -#Ensure user is logged in -docker login || (echo "Unable to login to DockerHub" && exit 1) - -#This script assumes it is in the same directory as the Dockerfile -docker build --no-cache -t $SIGNATURE . - -#Push image to DockerHub -docker push "$SIGNATURE" - -#Add a comment to the Dockerfile and script -sed -i '' -e '/.*Currently tagged in DockerHub as.*/d' *Dockerfile -cat << EOF >> *Dockerfile - -# Currently tagged in DockerHub as: $SIGNATURE -EOF diff --git a/dev/com.ibm.ws.jdbc_fat_krb5/publish/files/kdc-server/Dockerfile b/dev/com.ibm.ws.jdbc_fat_krb5/publish/files/kdc-server/Dockerfile deleted file mode 100644 index 45f526b2f8c7..000000000000 --- a/dev/com.ibm.ws.jdbc_fat_krb5/publish/files/kdc-server/Dockerfile +++ /dev/null @@ -1,7 +0,0 @@ -FROM gcavalcante8808/krb5-server - -COPY docker-entrypoint.sh / -ENTRYPOINT ["/sbin/tini", "--"] -CMD ["/docker-entrypoint.sh"] - -# Currently tagged in DockerHub as: kyleaure/krb5-server:1.0 diff --git a/dev/com.ibm.ws.jdbc_fat_krb5/publish/files/kdc-server/release.sh b/dev/com.ibm.ws.jdbc_fat_krb5/publish/files/kdc-server/release.sh deleted file mode 100755 index 3a9c3a2c4fbc..000000000000 --- a/dev/com.ibm.ws.jdbc_fat_krb5/publish/files/kdc-server/release.sh +++ /dev/null @@ -1,31 +0,0 @@ -#!/bin/bash - -#Needs to be provided by user -USER_NAME=kyleaure - -#Version of docker image. Increment if doing a new release -VERSION=1.0 - -#Name of the final image -IMAGE_NAME=krb5-server - -#Docker image signiture in form username/image:version -SIGNATURE=$USER_NAME/$IMAGE_NAME:$VERSION - -echo "Attempting to build and push $SIGNATURE" - -#Ensure user is logged in -docker login || (echo "Unable to login to DockerHub" && exit 1) - -#This script assumes it is in the same directory as the Dockerfile -docker build --no-cache -t $SIGNATURE . - -#Push image to DockerHub -docker push "$SIGNATURE" - -#Add a comment to the Dockerfile and script -sed -i '' -e '/.*Currently tagged in DockerHub as.*/d' *Dockerfile -cat << EOF >> *Dockerfile - -# Currently tagged in DockerHub as: $SIGNATURE -EOF diff --git a/dev/com.ibm.ws.jdbc_fat_krb5/publish/files/oracle/release.sh b/dev/com.ibm.ws.jdbc_fat_krb5/publish/files/oracle/release.sh deleted file mode 100755 index 1b0991bf0b4c..000000000000 --- a/dev/com.ibm.ws.jdbc_fat_krb5/publish/files/oracle/release.sh +++ /dev/null @@ -1,31 +0,0 @@ -#!/bin/bash - -#Needs to be provided by user -USER_NAME=kyleaure - -#Version of docker image. Increment if doing a new release -VERSION=1.0.full.krb5 - -#Name of the final image -IMAGE_NAME=oracle-21.3.0-faststart - -#Docker image signiture in form username/image:version -SIGNATURE=$USER_NAME/$IMAGE_NAME:$VERSION - -echo "Attempting to build and push $SIGNATURE" - -#Ensure user is logged in -docker login || (echo "Unable to login to DockerHub" && exit 1) - -#This script assumes it is in the same directory as the Dockerfile -docker build -t $SIGNATURE . - -#Push image to DockerHub -docker push "$SIGNATURE" - -#Add a comment to the Dockerfile and script -sed -i '' -e '/.*Currently tagged in DockerHub as.*/d' *Dockerfile -cat << EOF >> *Dockerfile - -# Currently tagged in DockerHub as: $SIGNATURE -EOF diff --git a/dev/com.ibm.ws.jdbc_fat_krb5/publish/files/postgresql/release.sh b/dev/com.ibm.ws.jdbc_fat_krb5/publish/files/postgresql/release.sh deleted file mode 100755 index 44438dc6ac25..000000000000 --- a/dev/com.ibm.ws.jdbc_fat_krb5/publish/files/postgresql/release.sh +++ /dev/null @@ -1,31 +0,0 @@ -#!/bin/bash - -#Needs to be provided by user -USER_NAME=kyleaure - -#Version of docker image. Increment if doing a new release -VERSION=1.0 - -#Name of the final image -IMAGE_NAME=postgres-krb5 - -#Docker image signiture in form username/image:version -SIGNATURE=$USER_NAME/$IMAGE_NAME:$VERSION - -echo "Attempting to build and push $SIGNATURE" - -#Ensure user is logged in -docker login || (echo "Unable to login to DockerHub" && exit 1) - -#This script assumes it is in the same directory as the Dockerfile -docker build --no-cache -t $SIGNATURE . - -#Push image to DockerHub -docker push "$SIGNATURE" - -#Add a comment to the Dockerfile and script -sed -i '' -e '/.*Currently tagged in DockerHub as.*/d' *Dockerfile -cat << EOF >> *Dockerfile - -# Currently tagged in DockerHub as: $SIGNATURE -EOF diff --git a/dev/com.ibm.ws.jdbc_fat_oracle/fat/src/com/ibm/ws/jdbc/fat/oracle/OracleSSLTest.java b/dev/com.ibm.ws.jdbc_fat_oracle/fat/src/com/ibm/ws/jdbc/fat/oracle/OracleSSLTest.java index a1617b17cd30..b78bfed089d3 100644 --- a/dev/com.ibm.ws.jdbc_fat_oracle/fat/src/com/ibm/ws/jdbc/fat/oracle/OracleSSLTest.java +++ b/dev/com.ibm.ws.jdbc_fat_oracle/fat/src/com/ibm/ws/jdbc/fat/oracle/OracleSSLTest.java @@ -62,6 +62,17 @@ public static void setUp() throws Exception { // Create a normal Java EE application and export to server ShrinkHelper.defaultApp(server, JEE_APP, "ssl.web"); + // TODO extract security files from container prior to server start + // TODO delete security files from git + + // Copy wallet files +// oracle.copyFileFromContainer("/client/oracle/wallet/ewallet.p12", server.getServerRoot() + "/security/ewallet.p12"); +// oracle.copyFileFromContainer("/client/oracle/wallet/cwallet.sso", server.getServerRoot() + "/security/cwallet.sso"); + + // Copy keystore files +// oracle.copyFileFromContainer("/client/oracle/store/client-keystore.jks", server.getServerRoot() + "/store/client-keystore.jks"); +// oracle.copyFileFromContainer("/client/oracle/store/client-truststore.jks", server.getServerRoot() + "/store/client-truststore.jks"); + // Start Server server.startServer(); } diff --git a/dev/com.ibm.ws.jdbc_fat_oracle/publish/files/oracle-ssl/release.sh b/dev/com.ibm.ws.jdbc_fat_oracle/publish/files/oracle-ssl/release.sh deleted file mode 100755 index 365c2396f5c8..000000000000 --- a/dev/com.ibm.ws.jdbc_fat_oracle/publish/files/oracle-ssl/release.sh +++ /dev/null @@ -1,50 +0,0 @@ -#!/bin/bash - -#Needs to be provided by user -USER_NAME=kyleaure - -#Version of docker image. Increment if doing a new release -VERSION=1.0.full.ssl - -#Name of the final image -IMAGE_NAME=oracle-21.3.0-faststart - -#Docker image signiture in form username/image:version -SIGNATURE=$USER_NAME/$IMAGE_NAME:$VERSION - -echo "Attempting to build and push $SIGNATURE" - -#Ensure user is logged in -docker login || (echo "Unable to login to DockerHub" && exit 1) - -#This script assumes it is in the same directory as the Dockerfile -docker build --no-cache -t $SIGNATURE . - -#Extract wallet -SECURITY_DIR=../../servers/com.ibm.ws.jdbc.fat.oracle.ssl/security/ -STORE_DIR=../../servers/com.ibm.ws.jdbc.fat.oracle.ssl/store/ -CONTAINER="TMP-CONTAINER" - -mkdir -p $SECURITY_DIR -mkdir -p $STORE_DIR - -docker create --name $CONTAINER $SIGNATURE -docker cp $CONTAINER:/client/oracle/wallet/ewallet.p12 $SECURITY_DIR -docker cp $CONTAINER:/client/oracle/wallet/cwallet.sso $SECURITY_DIR -docker cp $CONTAINER:/client/oracle/store/client-keystore.jks $STORE_DIR -docker cp $CONTAINER:/client/oracle/store/client-truststore.jks $STORE_DIR -docker rm $CONTAINER - -#Make security files readable -chmod -R 755 $SECURITY_DIR -chmod -R 755 $STORE_DIR - -#Push image to DockerHub -docker push "$SIGNATURE" - -#Add a comment to the Dockerfile and script -sed -i '' -e '/.*Currently tagged in DockerHub as.*/d' *Dockerfile -cat << EOF >> *Dockerfile - -# Currently tagged in DockerHub as: $SIGNATURE -EOF diff --git a/dev/com.ibm.ws.jdbc_fat_postgresql/publish/files/postgresql-ssl/release.sh b/dev/com.ibm.ws.jdbc_fat_postgresql/publish/files/postgresql-ssl/release.sh deleted file mode 100755 index 23366f3a8f6f..000000000000 --- a/dev/com.ibm.ws.jdbc_fat_postgresql/publish/files/postgresql-ssl/release.sh +++ /dev/null @@ -1,31 +0,0 @@ -#!/bin/bash - -#Needs to be provided by user -USER_NAME=kyleaure - -#Version of docker image. Increment if doing a new release -VERSION=1.0 - -#Name of the final image -IMAGE_NAME=postgres-ssl - -#Docker image signiture in form username/image:version -SIGNATURE=$USER_NAME/$IMAGE_NAME:$VERSION - -echo "Attempting to build and push $SIGNATURE" - -#Ensure user is logged in -docker login || (echo "Unable to login to DockerHub" && exit 1) - -#This script assumes it is in the same directory as the Dockerfile -docker build --no-cache -t $SIGNATURE . - -#Push image to DockerHub -docker push "$SIGNATURE" - -#Add a comment to the Dockerfile and script -sed -i '' -e '/.*Currently tagged in DockerHub as.*/d' *Dockerfile -cat << EOF >> *Dockerfile - -# Currently tagged in DockerHub as: $SIGNATURE -EOF diff --git a/dev/com.ibm.ws.jdbc_fat_sqlserver/fat/src/com/ibm/ws/jdbc/fat/sqlserver/SQLServerSSLTest.java b/dev/com.ibm.ws.jdbc_fat_sqlserver/fat/src/com/ibm/ws/jdbc/fat/sqlserver/SQLServerSSLTest.java index 943ac28c152c..4dd80ad7e410 100644 --- a/dev/com.ibm.ws.jdbc_fat_sqlserver/fat/src/com/ibm/ws/jdbc/fat/sqlserver/SQLServerSSLTest.java +++ b/dev/com.ibm.ws.jdbc_fat_sqlserver/fat/src/com/ibm/ws/jdbc/fat/sqlserver/SQLServerSSLTest.java @@ -78,6 +78,11 @@ public static void setUp() throws Exception { // Create a normal Java EE application and export to server ShrinkHelper.defaultApp(server, APP_NAME, "web.ssl"); + // TODO extract security files from container prior to server start + // TODO delete security files from git + +// sqlserver.copyFileFromContainer("/truststore.p12", server.getServerRoot() + "/security/truststore.p12"); + server.startServer(); } diff --git a/dev/com.ibm.ws.jdbc_fat_sqlserver/publish/files/sqlserver-ssl/Dockerfile b/dev/com.ibm.ws.jdbc_fat_sqlserver/publish/files/sqlserver-ssl/Dockerfile deleted file mode 100644 index 148058d7145f..000000000000 --- a/dev/com.ibm.ws.jdbc_fat_sqlserver/publish/files/sqlserver-ssl/Dockerfile +++ /dev/null @@ -1,10 +0,0 @@ -# TODO update to mcr.microsoft.com/mssql/server:2019-CU28-ubuntu-20.04 - -FROM mcr.microsoft.com/mssql/server:2019-CU18-ubuntu-20.04 - -COPY --chown=mssql:0 container-files/mssql.conf /var/opt/mssql/mssql.conf -COPY --chown=mssql:0 container-files/mssql.pem /etc/ssl/certs/mssql.pem -COPY --chown=mssql:0 container-files/mssql.key /etc/ssl/mssql.key - - -# Currently tagged in DockerHub as: kyleaure/sqlserver-ssl:2019-CU18-ubuntu-20.04 diff --git a/dev/com.ibm.ws.jdbc_fat_sqlserver/publish/files/sqlserver-ssl/release.sh b/dev/com.ibm.ws.jdbc_fat_sqlserver/publish/files/sqlserver-ssl/release.sh deleted file mode 100755 index 706481b92ac8..000000000000 --- a/dev/com.ibm.ws.jdbc_fat_sqlserver/publish/files/sqlserver-ssl/release.sh +++ /dev/null @@ -1,48 +0,0 @@ -#!/bin/bash -#Sample script to make it easier to push custom images to dockerhub - -#TODO needs to be provided by user -USER_NAME=kyleaure - -#TODO need to provide version of docker image. Increment if doing a new release -VERSION=2019-CU18-ubuntu-20.04 - -#TODO need to provide name of the final image -IMAGE_NAME=sqlserver-ssl - -#Docker image signiture in form username/image:version -SIGNITURE=$USER_NAME/$IMAGE_NAME:$VERSION - -echo "Attempting to build and push $SIGNITURE" - -#Ensure user is logged in -docker login || (echo "Unable to login to DockerHub" && exit 1) - -#This script assumes it is in the same directory as the Dockerfile -docker build -t "$SIGNITURE" . - -#Extract keystore -CONTAINER="tmp-container" -SECURITY_DIR=../../servers/com.ibm.ws.jdbc.fat.sqlserver.ssl/security/ -PASSWORD="WalletPasswd123" - -rm -rf $SECURITY_DIR && mkdir -p $SECURITY_DIR - -docker create --name $CONTAINER $SIGNITURE -docker cp $CONTAINER:/etc/ssl/certs/mssql.pem $SECURITY_DIR -docker cp $CONTAINER:/etc/ssl/mssql.key $SECURITY_DIR -docker rm $CONTAINER - -keytool -importcert -file $SECURITY_DIR/mssql.pem -alias server -keystore $SECURITY_DIR/truststore.p12 -storepass $PASSWORD -storetype PKCS12 -keytool -list -v -keystore $SECURITY_DIR/truststore.p12 -storepass $PASSWORD -rm $SECURITY_DIR/mssql.pem $SECURITY_DIR/mssql.key - -#Push image to DockerHub -docker push "$SIGNITURE" - -#Add a comment to the Dockerfile and script -sed -i '' -e '/.*Currently tagged in DockerHub as.*/d' *Dockerfile -cat << EOF >> *Dockerfile - -# Currently tagged in DockerHub as: $SIGNITURE -EOF diff --git a/dev/com.ibm.ws.logstash.collector_fat/fat/src/com/ibm/ws/logstash/collector/tests/LogstashCollectorTest.java b/dev/com.ibm.ws.logstash.collector_fat/fat/src/com/ibm/ws/logstash/collector/tests/LogstashCollectorTest.java index 7b11f43f8e7b..4e86d3340322 100644 --- a/dev/com.ibm.ws.logstash.collector_fat/fat/src/com/ibm/ws/logstash/collector/tests/LogstashCollectorTest.java +++ b/dev/com.ibm.ws.logstash.collector_fat/fat/src/com/ibm/ws/logstash/collector/tests/LogstashCollectorTest.java @@ -189,6 +189,8 @@ private String getAppUrl() { return APP_URL; } + //TODO switch to use public.ecr.aws/elastic/logstash:7.16.3 + //TODO remove withDockerfileFromBuilder and instead create a dockerfile private static final String IMAGE_NAME = ImageNameSubstitutor.instance() // .apply(DockerImageName.parse("elastic/logstash:7.16.3")).asCanonicalNameString(); diff --git a/dev/com.ibm.ws.rest.handler.validator.cloudant_fat/publish/files/cloudant-dev/Dockerfile b/dev/com.ibm.ws.rest.handler.validator.cloudant_fat/publish/files/cloudant-dev/Dockerfile deleted file mode 100644 index 637bb1b99ed2..000000000000 --- a/dev/com.ibm.ws.rest.handler.validator.cloudant_fat/publish/files/cloudant-dev/Dockerfile +++ /dev/null @@ -1,8 +0,0 @@ -FROM ibmcom/cloudant-developer:2.0.1 - -#Contains vulnerable log4j library for features not needed for testing -RUN rm -rf /opt/cloudant/search/ -RUN rm -rf /opt/cloudant/etc/log4j.properties - - -# Currently tagged in DockerHub as: kyleaure/cloudant-developer:1.0 diff --git a/dev/com.ibm.ws.rest.handler.validator.cloudant_fat/publish/files/cloudant-dev/release.sh b/dev/com.ibm.ws.rest.handler.validator.cloudant_fat/publish/files/cloudant-dev/release.sh deleted file mode 100755 index 610c2bf22d52..000000000000 --- a/dev/com.ibm.ws.rest.handler.validator.cloudant_fat/publish/files/cloudant-dev/release.sh +++ /dev/null @@ -1,31 +0,0 @@ -#!/bin/bash - -#Needs to be provided by user -USER_NAME=kyleaure - -#Version of docker image. Increment if doing a new release -VERSION=1.0 - -#Name of the final image -IMAGE_NAME=cloudant-developer - -#Docker image signiture in form username/image:version -SIGNATURE=$USER_NAME/$IMAGE_NAME:$VERSION - -echo "Attempting to build and push $SIGNATURE" - -#Ensure user is logged in -docker login || (echo "Unable to login to DockerHub" && exit 1) - -#This script assumes it is in the same directory as the Dockerfile -docker build --no-cache -t $SIGNATURE . - -#Push image to DockerHub -docker push "$SIGNATURE" - -#Add a comment to the Dockerfile and script -sed -i '' -e '/.*Currently tagged in DockerHub as.*/d' *Dockerfile -cat << EOF >> *Dockerfile - -# Currently tagged in DockerHub as: $SIGNATURE -EOF diff --git a/dev/com.ibm.ws.security.acme_fat/fat/src/com/ibm/ws/security/acme/docker/boulder/BoulderContainer.java b/dev/com.ibm.ws.security.acme_fat/fat/src/com/ibm/ws/security/acme/docker/boulder/BoulderContainer.java index 868673d470d0..820269850705 100644 --- a/dev/com.ibm.ws.security.acme_fat/fat/src/com/ibm/ws/security/acme/docker/boulder/BoulderContainer.java +++ b/dev/com.ibm.ws.security.acme_fat/fat/src/com/ibm/ws/security/acme/docker/boulder/BoulderContainer.java @@ -91,6 +91,7 @@ public class BoulderContainer extends CAContainer { /** * Docker image that contains all the files from boulder-tools-go. + * TODO publish Dockerfile for this custom image */ private static final String DOCKER_IMAGE = "ryanesch/acme-boulder:1.2"; diff --git a/dev/com.ibm.ws.security.acme_fat/fat/src/com/ibm/ws/security/acme/docker/pebble/PebbleContainer.java b/dev/com.ibm.ws.security.acme_fat/fat/src/com/ibm/ws/security/acme/docker/pebble/PebbleContainer.java index df26f4721125..56c0004d55be 100644 --- a/dev/com.ibm.ws.security.acme_fat/fat/src/com/ibm/ws/security/acme/docker/pebble/PebbleContainer.java +++ b/dev/com.ibm.ws.security.acme_fat/fat/src/com/ibm/ws/security/acme/docker/pebble/PebbleContainer.java @@ -99,6 +99,8 @@ public static void log(OutputFrame frame) { * Address of the DNS server to use to make DNS lookups for * domains. */ + //TODO switch to use ghcr.io/letsencrypt/pebble:2.6.0 + //TODO remove withDockerfileFromBuilder and instead create a dockerfile public PebbleContainer() { super(new ImageFromDockerfile() .withDockerfileFromBuilder(builder -> builder.from( diff --git a/dev/com.ibm.ws.security.wim.adapter.ldap_fat.krb5.1/publish/files/kdc-server/Dockerfile b/dev/com.ibm.ws.security.wim.adapter.ldap_fat.krb5.1/publish/files/kdc-server/Dockerfile deleted file mode 100644 index baed71abc514..000000000000 --- a/dev/com.ibm.ws.security.wim.adapter.ldap_fat.krb5.1/publish/files/kdc-server/Dockerfile +++ /dev/null @@ -1,8 +0,0 @@ -FROM gcavalcante8808/krb5-server - -COPY docker-entrypoint.sh / -ENTRYPOINT ["/sbin/tini", "--"] -CMD ["/docker-entrypoint.sh"] - - -# Currently tagged in DockerHub as: zachhein/krb5-server:0.2 diff --git a/dev/com.ibm.ws.security.wim.adapter.ldap_fat.krb5.1/publish/files/kdc-server/release.sh b/dev/com.ibm.ws.security.wim.adapter.ldap_fat.krb5.1/publish/files/kdc-server/release.sh deleted file mode 100644 index 6cb8edc6f0f3..000000000000 --- a/dev/com.ibm.ws.security.wim.adapter.ldap_fat.krb5.1/publish/files/kdc-server/release.sh +++ /dev/null @@ -1,31 +0,0 @@ -#!/bin/bash - -#Needs to be provided by user -USER_NAME=zachhein - -#Version of docker image. Increment if doing a new release -VERSION=0.2 - -#Name of the final image -IMAGE_NAME=krb5-server - -#Docker image signiture in form username/image:version -SIGNATURE=$USER_NAME/$IMAGE_NAME:$VERSION - -echo "Attempting to build and push $SIGNATURE" - -#Ensure user is logged in -docker login || (echo "Unable to login to DockerHub" && exit 1) - -#This script assumes it is in the same directory as the Dockerfile -docker build --no-cache -t $SIGNATURE . - -#Push image to DockerHub -docker push "$SIGNATURE" - -#Add a comment to the Dockerfile and script -sed -i '' -e '/.*Currently tagged in DockerHub as.*/d' *Dockerfile -cat << EOF >> *Dockerfile - -# Currently tagged in DockerHub as: $SIGNATURE -EOF diff --git a/dev/com.ibm.ws.security.wim.adapter.ldap_fat.krb5.1/publish/files/ldap-server/release.sh b/dev/com.ibm.ws.security.wim.adapter.ldap_fat.krb5.1/publish/files/ldap-server/release.sh deleted file mode 100644 index a07b9ce252d1..000000000000 --- a/dev/com.ibm.ws.security.wim.adapter.ldap_fat.krb5.1/publish/files/ldap-server/release.sh +++ /dev/null @@ -1,31 +0,0 @@ -#!/bin/bash - -#Needs to be provided by user -USER_NAME=zachhein - -#Version of docker image. Increment if doing a new release -VERSION=0.5 - -#Name of the final image -IMAGE_NAME=ldap-server - -#Docker image signiture in form username/image:version -SIGNATURE=$USER_NAME/$IMAGE_NAME:$VERSION - -echo "Attempting to build and push $SIGNATURE" - -#Ensure user is logged in -docker login || (echo "Unable to login to DockerHub" && exit 1) - -#This script assumes it is in the same directory as the Dockerfile -docker build --no-cache -t $SIGNATURE . - -#Push image to DockerHub -docker push "$SIGNATURE" - -#Add a comment to the Dockerfile and script -sed -i '' -e '/.*Currently tagged in DockerHub as.*/d' *Dockerfile -cat << EOF >> *Dockerfile - -# Currently tagged in DockerHub as: $SIGNATURE -EOF diff --git a/dev/com.ibm.ws.session.cache_fat_infinispan_container/fat/src/com/ibm/ws/session/cache/fat/infinispan/container/FATSuite.java b/dev/com.ibm.ws.session.cache_fat_infinispan_container/fat/src/com/ibm/ws/session/cache/fat/infinispan/container/FATSuite.java index 297599ee7dff..ca4504838b29 100644 --- a/dev/com.ibm.ws.session.cache_fat_infinispan_container/fat/src/com/ibm/ws/session/cache/fat/infinispan/container/FATSuite.java +++ b/dev/com.ibm.ws.session.cache_fat_infinispan_container/fat/src/com/ibm/ws/session/cache/fat/infinispan/container/FATSuite.java @@ -101,6 +101,8 @@ public static void beforeSuite() throws Exception { * - Copies user.properties for authentication (user: user, password: pass) * - Starts using a custom command to call server.sh with the copied config.xml */ + //TODO switch to use quay.io/infinispan/server:10.0.1.Final + //TODO remove withDockerfileFromBuilder and instead create a dockerfile @ClassRule public static GenericContainer infinispan = new GenericContainer<>(new ImageFromDockerfile() .withDockerfileFromBuilder(builder -> builder.from( diff --git a/dev/io.openliberty.checkpoint_fat_session_cache_infinispan_container/fat/src/io/openliberty/checkpoint/session/cache/infinispan/container/FATSuite.java b/dev/io.openliberty.checkpoint_fat_session_cache_infinispan_container/fat/src/io/openliberty/checkpoint/session/cache/infinispan/container/FATSuite.java index a808d4b83c88..8693e1e1d4a7 100644 --- a/dev/io.openliberty.checkpoint_fat_session_cache_infinispan_container/fat/src/io/openliberty/checkpoint/session/cache/infinispan/container/FATSuite.java +++ b/dev/io.openliberty.checkpoint_fat_session_cache_infinispan_container/fat/src/io/openliberty/checkpoint/session/cache/infinispan/container/FATSuite.java @@ -114,6 +114,8 @@ public static void beforeSuite() throws Exception { * - Copies user.properties for authentication (user: user, password: pass) * - Starts using a custom command to call server.sh with the copied config.xml */ + //TODO switch to use quay.io/infinispan/server:10.0.1.Final + //TODO remove withDockerfileFromBuilder and instead create a dockerfile @ClassRule public static GenericContainer infinispan = new GenericContainer<>(new ImageFromDockerfile() .withDockerfileFromBuilder(builder -> builder.from( diff --git a/dev/io.openliberty.http.monitor_fat/fat/src/io/openliberty/http/monitor/fat/ContainerJSFApplicationTest.java b/dev/io.openliberty.http.monitor_fat/fat/src/io/openliberty/http/monitor/fat/ContainerJSFApplicationTest.java index 25783d5bfb0b..8e5f254c4188 100644 --- a/dev/io.openliberty.http.monitor_fat/fat/src/io/openliberty/http/monitor/fat/ContainerJSFApplicationTest.java +++ b/dev/io.openliberty.http.monitor_fat/fat/src/io/openliberty/http/monitor/fat/ContainerJSFApplicationTest.java @@ -50,6 +50,8 @@ public class ContainerJSFApplicationTest extends BaseTestClass { @ClassRule public static RepeatTests rt = FATSuite.allMPRepeatsWithMPTel20OrLater(SERVER_NAME); + //TODO switch to use ghcr.io/open-telemetry/opentelemetry-collector-releases/opentelemetry-collector-contrib:0.117.0 + //TODO remove withDockerfileFromBuilder and instead create a dockerfile @ClassRule public static GenericContainer container = new GenericContainer<>(new ImageFromDockerfile() .withDockerfileFromBuilder(builder -> builder.from(IMAGE_NAME) diff --git a/dev/io.openliberty.http.monitor_fat/fat/src/io/openliberty/http/monitor/fat/ContainerJSPApplicationTest.java b/dev/io.openliberty.http.monitor_fat/fat/src/io/openliberty/http/monitor/fat/ContainerJSPApplicationTest.java index 0b62551a727d..9815fa44402f 100644 --- a/dev/io.openliberty.http.monitor_fat/fat/src/io/openliberty/http/monitor/fat/ContainerJSPApplicationTest.java +++ b/dev/io.openliberty.http.monitor_fat/fat/src/io/openliberty/http/monitor/fat/ContainerJSPApplicationTest.java @@ -48,6 +48,8 @@ public class ContainerJSPApplicationTest extends BaseTestClass { @ClassRule public static RepeatTests rt = FATSuite.allMPRepeatsWithMPTel20OrLater(SERVER_NAME); + //TODO switch to use ghcr.io/open-telemetry/opentelemetry-collector-releases/opentelemetry-collector-contrib:0.117.0 + //TODO remove withDockerfileFromBuilder and instead create a dockerfile @ClassRule public static GenericContainer container = new GenericContainer<>(new ImageFromDockerfile() .withDockerfileFromBuilder(builder -> builder.from(IMAGE_NAME) diff --git a/dev/io.openliberty.http.monitor_fat/fat/src/io/openliberty/http/monitor/fat/ContainerNoAppTest.java b/dev/io.openliberty.http.monitor_fat/fat/src/io/openliberty/http/monitor/fat/ContainerNoAppTest.java index f198dc4bf5d0..5a6400ba2697 100644 --- a/dev/io.openliberty.http.monitor_fat/fat/src/io/openliberty/http/monitor/fat/ContainerNoAppTest.java +++ b/dev/io.openliberty.http.monitor_fat/fat/src/io/openliberty/http/monitor/fat/ContainerNoAppTest.java @@ -47,6 +47,8 @@ public class ContainerNoAppTest extends BaseTestClass { @ClassRule public static RepeatTests rt = FATSuite.allMPRepeatsWithMPTel20OrLater(SERVER_NAME); + //TODO switch to use ghcr.io/open-telemetry/opentelemetry-collector-releases/opentelemetry-collector-contrib:0.117.0 + //TODO remove withDockerfileFromBuilder and instead create a dockerfile @ClassRule public static GenericContainer container = new GenericContainer<>(new ImageFromDockerfile() .withDockerfileFromBuilder(builder -> builder.from(IMAGE_NAME) diff --git a/dev/io.openliberty.http.monitor_fat/fat/src/io/openliberty/http/monitor/fat/ContainerRestApplicationTest.java b/dev/io.openliberty.http.monitor_fat/fat/src/io/openliberty/http/monitor/fat/ContainerRestApplicationTest.java index 05a31748b482..02948564e38f 100644 --- a/dev/io.openliberty.http.monitor_fat/fat/src/io/openliberty/http/monitor/fat/ContainerRestApplicationTest.java +++ b/dev/io.openliberty.http.monitor_fat/fat/src/io/openliberty/http/monitor/fat/ContainerRestApplicationTest.java @@ -56,6 +56,8 @@ public class ContainerRestApplicationTest extends BaseTestClass { @ClassRule public static RepeatTests rt = FATSuite.allMPRepeatsWithMPTel20OrLater(SERVER_NAME); + //TODO switch to use ghcr.io/open-telemetry/opentelemetry-collector-releases/opentelemetry-collector-contrib:0.117.0 + //TODO remove withDockerfileFromBuilder and instead create a dockerfile @ClassRule public static GenericContainer container = new GenericContainer<>(new ImageFromDockerfile() .withDockerfileFromBuilder(builder -> builder.from(IMAGE_NAME) diff --git a/dev/io.openliberty.http.monitor_fat/fat/src/io/openliberty/http/monitor/fat/ContainerServletApplicationTest.java b/dev/io.openliberty.http.monitor_fat/fat/src/io/openliberty/http/monitor/fat/ContainerServletApplicationTest.java index bdfaac5c7881..77cece8ef755 100644 --- a/dev/io.openliberty.http.monitor_fat/fat/src/io/openliberty/http/monitor/fat/ContainerServletApplicationTest.java +++ b/dev/io.openliberty.http.monitor_fat/fat/src/io/openliberty/http/monitor/fat/ContainerServletApplicationTest.java @@ -52,6 +52,8 @@ public class ContainerServletApplicationTest extends BaseTestClass { @ClassRule public static RepeatTests rt = FATSuite.allMPRepeatsWithMPTel20OrLater(SERVER_NAME); + //TODO switch to use ghcr.io/open-telemetry/opentelemetry-collector-releases/opentelemetry-collector-contrib:0.117.0 + //TODO remove withDockerfileFromBuilder and instead create a dockerfile @ClassRule public static GenericContainer container = new GenericContainer<>(new ImageFromDockerfile() .withDockerfileFromBuilder(builder -> builder.from(IMAGE_NAME) diff --git a/dev/io.openliberty.microprofile.telemetry.1.0.internal.container_fat/fat/src/io/openliberty/microprofile/telemetry/internal/utils/jaeger/JaegerContainer.java b/dev/io.openliberty.microprofile.telemetry.1.0.internal.container_fat/fat/src/io/openliberty/microprofile/telemetry/internal/utils/jaeger/JaegerContainer.java index b3332cf53073..9935550db3a2 100644 --- a/dev/io.openliberty.microprofile.telemetry.1.0.internal.container_fat/fat/src/io/openliberty/microprofile/telemetry/internal/utils/jaeger/JaegerContainer.java +++ b/dev/io.openliberty.microprofile.telemetry.1.0.internal.container_fat/fat/src/io/openliberty/microprofile/telemetry/internal/utils/jaeger/JaegerContainer.java @@ -46,6 +46,8 @@ public class JaegerContainer extends GenericContainer { public static final int HTTP_QUERY_PORT = 16686; public static final int GRPC_QUERY_PORT = 16685; + //TODO switch to use quay.io/jaegertracing/all-in-one:1.54 + //TODO remove withDockerfileFromBuilder and instead create a dockerfile public JaegerContainer(File tlsCert, File tlsKey) { super(new ImageFromDockerfile().withDockerfileFromBuilder(builder -> builder.from( ImageNameSubstitutor.instance() @@ -71,6 +73,8 @@ public JaegerContainer(File tlsCert, File tlsKey) { withEnv("QUERY_GRPC_TLS_KEY", "/etc/private.key"); } + //TODO switch to use quay.io/jaegertracing/all-in-one:1.54 + //TODO remove withDockerfileFromBuilder and instead create a dockerfile public JaegerContainer(File otelCollectorTlsCert, File otelCollectorTlsKey, File jaegerQueryTlsCert, File jaegerQueryTlsKey) { super(new ImageFromDockerfile().withDockerfileFromBuilder(builder -> builder.from( ImageNameSubstitutor.instance() diff --git a/dev/io.openliberty.microprofile.telemetry.1.0.internal.container_fat/fat/src/io/openliberty/microprofile/telemetry/internal/utils/otelCollector/OtelCollectorContainer.java b/dev/io.openliberty.microprofile.telemetry.1.0.internal.container_fat/fat/src/io/openliberty/microprofile/telemetry/internal/utils/otelCollector/OtelCollectorContainer.java index 8ac91bcd9800..1da31daac275 100644 --- a/dev/io.openliberty.microprofile.telemetry.1.0.internal.container_fat/fat/src/io/openliberty/microprofile/telemetry/internal/utils/otelCollector/OtelCollectorContainer.java +++ b/dev/io.openliberty.microprofile.telemetry.1.0.internal.container_fat/fat/src/io/openliberty/microprofile/telemetry/internal/utils/otelCollector/OtelCollectorContainer.java @@ -12,8 +12,6 @@ *******************************************************************************/ package io.openliberty.microprofile.telemetry.internal.utils.otelCollector; -import io.openliberty.microprofile.telemetry.internal.utils.TestConstants; - import java.io.File; import org.testcontainers.containers.GenericContainer; @@ -21,6 +19,8 @@ import org.testcontainers.utility.DockerImageName; import org.testcontainers.utility.ImageNameSubstitutor; +import io.openliberty.microprofile.telemetry.internal.utils.TestConstants; + /** * A container for the otelCollector trace server *

@@ -42,7 +42,7 @@ public OtelCollectorContainer(File configFile) { this(TestConstants.DOCKER_IMAGE_OPENTELEMETRY_COLLECTOR, configFile); } - public OtelCollectorContainer(File configFile, int port) { + public OtelCollectorContainer(File configFile, int port) { this(TestConstants.DOCKER_IMAGE_OPENTELEMETRY_COLLECTOR, configFile, port); } @@ -50,6 +50,8 @@ public OtelCollectorContainer(File configFile, File tlsCert, File tlsKey) { this(TestConstants.DOCKER_IMAGE_OPENTELEMETRY_COLLECTOR, configFile, tlsCert, tlsKey); } + //TODO switch to use ghcr.io/open-telemetry/opentelemetry-collector-releases/opentelemetry-collector:0.117.0 + //TODO remove withDockerfileFromBuilder and instead create a dockerfile public OtelCollectorContainer(DockerImageName imageName, File configFile) { super(new ImageFromDockerfile().withDockerfileFromBuilder(builder -> builder.from( ImageNameSubstitutor.instance() @@ -62,7 +64,9 @@ public OtelCollectorContainer(DockerImageName imageName, File configFile) { withCommand("--config=/etc/otel-collector-config.yaml"); } - public OtelCollectorContainer(DockerImageName imageName, File configFile, int PROMETHEUS_METRIC_PORT) { + //TODO switch to use ghcr.io/open-telemetry/opentelemetry-collector-releases/opentelemetry-collector:0.117.0 + //TODO remove withDockerfileFromBuilder and instead create a dockerfile + public OtelCollectorContainer(DockerImageName imageName, File configFile, int PROMETHEUS_METRIC_PORT) { super(new ImageFromDockerfile().withDockerfileFromBuilder(builder -> builder.from( ImageNameSubstitutor.instance() .apply(TestConstants.DOCKER_IMAGE_OPENTELEMETRY_COLLECTOR) @@ -74,6 +78,8 @@ public OtelCollectorContainer(DockerImageName imageName, File configFile, int PR withCommand("--config=/etc/otel-collector-config.yaml"); } + //TODO switch to use ghcr.io/open-telemetry/opentelemetry-collector-releases/opentelemetry-collector:0.117.0 + //TODO remove withDockerfileFromBuilder and instead create a dockerfile public OtelCollectorContainer(DockerImageName imageName, File configFile, File tlsCert, File tlsKey) { super(new ImageFromDockerfile().withDockerfileFromBuilder(builder -> builder.from( ImageNameSubstitutor.instance() @@ -101,7 +107,7 @@ public int getOtlpGrpcPort() { return getMappedPort(OTLP_GRPC_PORT); } - /** + /** * Get the port to use to send OTLP spans via gRPC *

* Only valid when the container is started diff --git a/dev/io.openliberty.microprofile.telemetry.1.0.internal.container_fat/fat/src/io/openliberty/microprofile/telemetry/internal/utils/zipkin/ZipkinContainer.java b/dev/io.openliberty.microprofile.telemetry.1.0.internal.container_fat/fat/src/io/openliberty/microprofile/telemetry/internal/utils/zipkin/ZipkinContainer.java index cc5cc2a5f819..a7e37ab209d8 100644 --- a/dev/io.openliberty.microprofile.telemetry.1.0.internal.container_fat/fat/src/io/openliberty/microprofile/telemetry/internal/utils/zipkin/ZipkinContainer.java +++ b/dev/io.openliberty.microprofile.telemetry.1.0.internal.container_fat/fat/src/io/openliberty/microprofile/telemetry/internal/utils/zipkin/ZipkinContainer.java @@ -4,7 +4,7 @@ * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-2.0/ - * + * * SPDX-License-Identifier: EPL-2.0 * * Contributors: @@ -12,11 +12,11 @@ *******************************************************************************/ package io.openliberty.microprofile.telemetry.internal.utils.zipkin; -import io.openliberty.microprofile.telemetry.internal.utils.TestConstants; - import org.testcontainers.containers.GenericContainer; import org.testcontainers.utility.DockerImageName; +import io.openliberty.microprofile.telemetry.internal.utils.TestConstants; + /** * A container for the Zipkin trace server *

@@ -27,6 +27,7 @@ * public static ZipkinContainer zipkinContainer = new ZipkinContainer().withLogConsumer(new SimpleLogConsumer(MyTest.class, "zipkin")); * */ +//TODO switch to use ghcr.io/openzipkin/zipkin-slim:2.23 public class ZipkinContainer extends GenericContainer { public static final int HTTP_PORT = 9411; diff --git a/dev/io.openliberty.microprofile.telemetry.2.0.logging.internal.container_fat/fat/src/io/openliberty/microprofile/telemetry/logging/internal/container/fat/JULDuplicateTest.java b/dev/io.openliberty.microprofile.telemetry.2.0.logging.internal.container_fat/fat/src/io/openliberty/microprofile/telemetry/logging/internal/container/fat/JULDuplicateTest.java index d535e16e336a..acf8d7ca4d3d 100644 --- a/dev/io.openliberty.microprofile.telemetry.2.0.logging.internal.container_fat/fat/src/io/openliberty/microprofile/telemetry/logging/internal/container/fat/JULDuplicateTest.java +++ b/dev/io.openliberty.microprofile.telemetry.2.0.logging.internal.container_fat/fat/src/io/openliberty/microprofile/telemetry/logging/internal/container/fat/JULDuplicateTest.java @@ -47,6 +47,8 @@ public class JULDuplicateTest { private static final String[] EXPECTED_FAILURES = { "CWMOT5005W", "SRVE0315E", "SRVE0777E" }; + //TODO switch to use ghcr.io/open-telemetry/opentelemetry-collector-releases/opentelemetry-collector-contrib:0.117.0 + //TODO remove withDockerfileFromBuilder and instead create a dockerfile @ClassRule public static GenericContainer container = new GenericContainer<>(new ImageFromDockerfile() .withDockerfileFromBuilder(builder -> builder.from(TestUtils.IMAGE_NAME) diff --git a/dev/io.openliberty.microprofile.telemetry.2.0.logging.internal.container_fat/fat/src/io/openliberty/microprofile/telemetry/logging/internal/container/fat/JULLogServletTest.java b/dev/io.openliberty.microprofile.telemetry.2.0.logging.internal.container_fat/fat/src/io/openliberty/microprofile/telemetry/logging/internal/container/fat/JULLogServletTest.java index fb8aa66246fc..764aa6a02eaa 100644 --- a/dev/io.openliberty.microprofile.telemetry.2.0.logging.internal.container_fat/fat/src/io/openliberty/microprofile/telemetry/logging/internal/container/fat/JULLogServletTest.java +++ b/dev/io.openliberty.microprofile.telemetry.2.0.logging.internal.container_fat/fat/src/io/openliberty/microprofile/telemetry/logging/internal/container/fat/JULLogServletTest.java @@ -45,6 +45,8 @@ public class JULLogServletTest { private static final String[] EXPECTED_FAILURES = { "CWMOT5005W", "SRVE0315E", "SRVE0777E" }; + //TODO switch to use ghcr.io/open-telemetry/opentelemetry-collector-releases/opentelemetry-collector-contrib:0.117.0 + //TODO remove withDockerfileFromBuilder and instead create a dockerfile @ClassRule public static GenericContainer container = new GenericContainer<>(new ImageFromDockerfile() .withDockerfileFromBuilder(builder -> builder.from(TestUtils.IMAGE_NAME) diff --git a/dev/io.openliberty.microprofile.telemetry.2.0.logging.internal.container_fat/fat/src/io/openliberty/microprofile/telemetry/logging/internal/container/fat/LoggingBridgeServletTest.java b/dev/io.openliberty.microprofile.telemetry.2.0.logging.internal.container_fat/fat/src/io/openliberty/microprofile/telemetry/logging/internal/container/fat/LoggingBridgeServletTest.java index bbdce6df0521..8f2ccaf21d08 100644 --- a/dev/io.openliberty.microprofile.telemetry.2.0.logging.internal.container_fat/fat/src/io/openliberty/microprofile/telemetry/logging/internal/container/fat/LoggingBridgeServletTest.java +++ b/dev/io.openliberty.microprofile.telemetry.2.0.logging.internal.container_fat/fat/src/io/openliberty/microprofile/telemetry/logging/internal/container/fat/LoggingBridgeServletTest.java @@ -43,6 +43,8 @@ public class LoggingBridgeServletTest { private static final String[] EXPECTED_FAILURES = { "CWMOT5005W", "SRVE0315E", "SRVE0777E" }; + //TODO switch to use ghcr.io/open-telemetry/opentelemetry-collector-releases/opentelemetry-collector-contrib:0.117.0 + //TODO remove withDockerfileFromBuilder and instead create a dockerfile @ClassRule public static GenericContainer container = new GenericContainer<>(new ImageFromDockerfile() .withDockerfileFromBuilder(builder -> builder.from(TestUtils.IMAGE_NAME) diff --git a/dev/io.openliberty.microprofile.telemetry.2.0.logging.internal.container_fat/fat/src/io/openliberty/microprofile/telemetry/logging/internal/container/fat/LoggingServletTest.java b/dev/io.openliberty.microprofile.telemetry.2.0.logging.internal.container_fat/fat/src/io/openliberty/microprofile/telemetry/logging/internal/container/fat/LoggingServletTest.java index a68a7676fc88..46eba07169c8 100644 --- a/dev/io.openliberty.microprofile.telemetry.2.0.logging.internal.container_fat/fat/src/io/openliberty/microprofile/telemetry/logging/internal/container/fat/LoggingServletTest.java +++ b/dev/io.openliberty.microprofile.telemetry.2.0.logging.internal.container_fat/fat/src/io/openliberty/microprofile/telemetry/logging/internal/container/fat/LoggingServletTest.java @@ -52,6 +52,8 @@ public class LoggingServletTest { public static final int WAIT_TIMEOUT = 5; // 5 seconds + //TODO switch to use ghcr.io/open-telemetry/opentelemetry-collector-releases/opentelemetry-collector-contrib:0.117.0 + //TODO remove withDockerfileFromBuilder and instead create a dockerfile @ClassRule public static GenericContainer container = new GenericContainer<>(new ImageFromDockerfile() .withDockerfileFromBuilder(builder -> builder.from(TestUtils.IMAGE_NAME) diff --git a/dev/io.openliberty.microprofile.telemetry.internal.monitor_fat/fat/src/io/openliberty/microprofile/telemetry/internal/monitor_fat/ConnectionPoolMetricsTest.java b/dev/io.openliberty.microprofile.telemetry.internal.monitor_fat/fat/src/io/openliberty/microprofile/telemetry/internal/monitor_fat/ConnectionPoolMetricsTest.java index 63cad61abeaf..8423928955dc 100644 --- a/dev/io.openliberty.microprofile.telemetry.internal.monitor_fat/fat/src/io/openliberty/microprofile/telemetry/internal/monitor_fat/ConnectionPoolMetricsTest.java +++ b/dev/io.openliberty.microprofile.telemetry.internal.monitor_fat/fat/src/io/openliberty/microprofile/telemetry/internal/monitor_fat/ConnectionPoolMetricsTest.java @@ -49,6 +49,8 @@ public class ConnectionPoolMetricsTest extends BaseTestClass { @ClassRule public static RepeatTests rt = FATSuite.testRepeatMPTel20(SERVER_NAME); + //TODO switch to use ghcr.io/open-telemetry/opentelemetry-collector-releases/opentelemetry-collector-contrib:0.117.0 + //TODO remove withDockerfileFromBuilder and instead create a dockerfile @ClassRule public static GenericContainer container = new GenericContainer<>(new ImageFromDockerfile() .withDockerfileFromBuilder(builder -> builder.from(IMAGE_NAME).copy("/etc/otelcol-contrib/config.yaml", diff --git a/dev/io.openliberty.microprofile.telemetry.internal.monitor_fat/fat/src/io/openliberty/microprofile/telemetry/internal/monitor_fat/LibertyMetricsTest.java b/dev/io.openliberty.microprofile.telemetry.internal.monitor_fat/fat/src/io/openliberty/microprofile/telemetry/internal/monitor_fat/LibertyMetricsTest.java index e586a36b9118..75c36ee434b5 100644 --- a/dev/io.openliberty.microprofile.telemetry.internal.monitor_fat/fat/src/io/openliberty/microprofile/telemetry/internal/monitor_fat/LibertyMetricsTest.java +++ b/dev/io.openliberty.microprofile.telemetry.internal.monitor_fat/fat/src/io/openliberty/microprofile/telemetry/internal/monitor_fat/LibertyMetricsTest.java @@ -42,6 +42,8 @@ public class LibertyMetricsTest extends BaseTestClass { @ClassRule public static RepeatTests rt = FATSuite.testRepeatMPTel20(SERVER_NAME); + //TODO switch to use ghcr.io/open-telemetry/opentelemetry-collector-releases/opentelemetry-collector-contrib:0.117.0 + //TODO remove withDockerfileFromBuilder and instead create a dockerfile @ClassRule public static GenericContainer container = new GenericContainer<>(new ImageFromDockerfile() .withDockerfileFromBuilder(builder -> builder.from(IMAGE_NAME).copy("/etc/otelcol-contrib/config.yaml", diff --git a/dev/io.openliberty.microprofile.telemetry.internal.monitor_fat/fat/src/io/openliberty/microprofile/telemetry/internal/monitor_fat/SessionMetricsTest.java b/dev/io.openliberty.microprofile.telemetry.internal.monitor_fat/fat/src/io/openliberty/microprofile/telemetry/internal/monitor_fat/SessionMetricsTest.java index eb43f509e4ba..29e849186c93 100644 --- a/dev/io.openliberty.microprofile.telemetry.internal.monitor_fat/fat/src/io/openliberty/microprofile/telemetry/internal/monitor_fat/SessionMetricsTest.java +++ b/dev/io.openliberty.microprofile.telemetry.internal.monitor_fat/fat/src/io/openliberty/microprofile/telemetry/internal/monitor_fat/SessionMetricsTest.java @@ -47,6 +47,8 @@ public class SessionMetricsTest extends BaseTestClass { @ClassRule public static RepeatTests rt = FATSuite.testRepeatMPTel20(SERVER_NAME); + //TODO switch to use ghcr.io/open-telemetry/opentelemetry-collector-releases/opentelemetry-collector-contrib:0.117.0 + //TODO remove withDockerfileFromBuilder and instead create a dockerfile @ClassRule public static GenericContainer container = new GenericContainer<>(new ImageFromDockerfile() .withDockerfileFromBuilder(builder -> builder.from(IMAGE_NAME).copy("/etc/otelcol-contrib/config.yaml", diff --git a/dev/io.openliberty.org.testcontainers/bnd.bnd b/dev/io.openliberty.org.testcontainers/bnd.bnd index 5f77b7a7a6fc..d7bc234c9b97 100644 --- a/dev/io.openliberty.org.testcontainers/bnd.bnd +++ b/dev/io.openliberty.org.testcontainers/bnd.bnd @@ -1,5 +1,5 @@ #******************************************************************************* -# Copyright (c) 2021, 2024 IBM Corporation and others. +# Copyright (c) 2021, 2025 IBM Corporation and others. # All rights reserved. This program and the accompanying materials # are made available under the terms of the Eclipse Public License 2.0 # which accompanies this distribution, and is available at @@ -38,7 +38,8 @@ Export-Package: \ #Ensure that /META-INF/service folder from testcontainers core project is included in bundle. # This will ensure that the other docker container strategies are accessible at runtime. Include-Resource: \ - @${repo;org.testcontainers:testcontainers;${testContainerVersion};EXACT}!/META-INF/** + @${repo;org.testcontainers:testcontainers;${testContainerVersion};EXACT}!/META-INF/**,\ + openliberty=resources/openliberty publish.wlp.jar.disabled: true diff --git a/dev/io.openliberty.org.testcontainers/build.gradle b/dev/io.openliberty.org.testcontainers/build.gradle index 8c2297b36eef..4e8a7aca7119 100644 --- a/dev/io.openliberty.org.testcontainers/build.gradle +++ b/dev/io.openliberty.org.testcontainers/build.gradle @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2022, 2024 IBM Corporation and others. + * Copyright (c) 2022, 2025 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at @@ -25,7 +25,7 @@ task assembleTestContainerData(type: JavaExec) { !isAutomatedBuild } - // Setup environment to mock external state + // Use ArtifactoryMirrorSubstitutor to generate images file environment "TESTCONTAINERS_IMAGE_SUBSTITUTOR", "componenttest.containers.ArtifactoryMirrorSubstitutor" classpath = configurations.runtime.plus(sourceSets.main.runtimeClasspath) @@ -34,12 +34,11 @@ task assembleTestContainerData(type: JavaExec) { } task generateCustomImages(type: JavaExec) { - onlyIf { // Prototype - should never be run - false - } - - // Ensure cache has been generated - dependsOn assembleTestContainerData + // TODO If artifactory is available then use it for substitution +// if ( gradle.userProps.containsKey("artifactory.docker.server") ) { +// environment "TESTCONTAINERS_IMAGE_SUBSTITUTOR", "componenttest.containers.ArtifactoryMirrorSubstitutor" +// environment "IMAGE_NAME_PREFIX", gradle.userProps.getProperty("artifactory.docker.server") +// } classpath = configurations.runtime.plus(sourceSets.main.runtimeClasspath) main = "io.openliberty.org.testcontainers.generate.CustomImages" diff --git a/dev/io.openliberty.org.testcontainers/dockerfiles/kyleaure/cloudant-developer/1.0/Dockerfile b/dev/io.openliberty.org.testcontainers/dockerfiles/kyleaure/cloudant-developer/1.0/Dockerfile deleted file mode 100644 index 9590b0c745f8..000000000000 --- a/dev/io.openliberty.org.testcontainers/dockerfiles/kyleaure/cloudant-developer/1.0/Dockerfile +++ /dev/null @@ -1,5 +0,0 @@ -FROM ibmcom/cloudant-developer:2.0.1 - -#Contains vulnerable log4j library for features not needed for testing -RUN rm -rf /opt/cloudant/search/ -RUN rm -rf /opt/cloudant/etc/log4j.properties diff --git a/dev/io.openliberty.org.testcontainers/resources/openliberty/testcontainers/cloudant-dev/2.0.1/Dockerfile b/dev/io.openliberty.org.testcontainers/resources/openliberty/testcontainers/cloudant-dev/2.0.1/Dockerfile new file mode 100644 index 000000000000..98346e99aa57 --- /dev/null +++ b/dev/io.openliberty.org.testcontainers/resources/openliberty/testcontainers/cloudant-dev/2.0.1/Dockerfile @@ -0,0 +1,10 @@ +# Base image used by external users is overwritten at runtime +# by a mirrored version from Artifactory for internal users. + +ARG BASE_IMAGE="ibmcom/cloudant-developer:2.0.1" + +FROM ${BASE_IMAGE} + +#Contains vulnerable log4j library for features not needed for testing +RUN rm -rf /opt/cloudant/search/ +RUN rm -rf /opt/cloudant/etc/log4j.properties diff --git a/dev/io.openliberty.org.testcontainers/resources/openliberty/testcontainers/couchdb-ssl/3.2.0/Dockerfile b/dev/io.openliberty.org.testcontainers/resources/openliberty/testcontainers/couchdb-ssl/3.2.0/Dockerfile new file mode 100644 index 000000000000..dc30da3a2a05 --- /dev/null +++ b/dev/io.openliberty.org.testcontainers/resources/openliberty/testcontainers/couchdb-ssl/3.2.0/Dockerfile @@ -0,0 +1,12 @@ +# Base image used by external users is overwritten at runtime +# by a mirrored version from Artifactory for internal users. + +ARG BASE_IMAGE="public.ecr.aws/docker/library/couchdb:3.2.0" + +FROM ${BASE_IMAGE} + +COPY couchdb-config/testcontainers_config.ini /opt/couchdb/etc/local.d/ +COPY ssl-certs/couchdb.pem /etc/couchdb/cert/ +COPY ssl-certs/privkey.pem /etc/couchdb/cert/ + +RUN chmod 644 /etc/couchdb/cert/* diff --git a/dev/com.ibm.ws.cloudant_fat/publish/files/couchdb-ssl/couchdb-config/testcontainers_config.ini b/dev/io.openliberty.org.testcontainers/resources/openliberty/testcontainers/couchdb-ssl/3.2.0/couchdb-config/testcontainers_config.ini similarity index 100% rename from dev/com.ibm.ws.cloudant_fat/publish/files/couchdb-ssl/couchdb-config/testcontainers_config.ini rename to dev/io.openliberty.org.testcontainers/resources/openliberty/testcontainers/couchdb-ssl/3.2.0/couchdb-config/testcontainers_config.ini diff --git a/dev/com.ibm.ws.cloudant_fat/publish/files/couchdb-ssl/ssl-certs/couchdb.pem b/dev/io.openliberty.org.testcontainers/resources/openliberty/testcontainers/couchdb-ssl/3.2.0/ssl-certs/couchdb.pem similarity index 100% rename from dev/com.ibm.ws.cloudant_fat/publish/files/couchdb-ssl/ssl-certs/couchdb.pem rename to dev/io.openliberty.org.testcontainers/resources/openliberty/testcontainers/couchdb-ssl/3.2.0/ssl-certs/couchdb.pem diff --git a/dev/com.ibm.ws.cloudant_fat/publish/files/couchdb-ssl/ssl-certs/privkey.pem b/dev/io.openliberty.org.testcontainers/resources/openliberty/testcontainers/couchdb-ssl/3.2.0/ssl-certs/privkey.pem similarity index 100% rename from dev/com.ibm.ws.cloudant_fat/publish/files/couchdb-ssl/ssl-certs/privkey.pem rename to dev/io.openliberty.org.testcontainers/resources/openliberty/testcontainers/couchdb-ssl/3.2.0/ssl-certs/privkey.pem diff --git a/dev/com.ibm.ws.cloudant_fat/publish/files/couchdb-ssl/ssl-certs/server.req b/dev/io.openliberty.org.testcontainers/resources/openliberty/testcontainers/couchdb-ssl/3.2.0/ssl-certs/server.req similarity index 100% rename from dev/com.ibm.ws.cloudant_fat/publish/files/couchdb-ssl/ssl-certs/server.req rename to dev/io.openliberty.org.testcontainers/resources/openliberty/testcontainers/couchdb-ssl/3.2.0/ssl-certs/server.req diff --git a/dev/com.ibm.ws.jdbc_fat_krb5/publish/files/db2/Dockerfile b/dev/io.openliberty.org.testcontainers/resources/openliberty/testcontainers/db2-krb5/12.1.0.0/Dockerfile similarity index 61% rename from dev/com.ibm.ws.jdbc_fat_krb5/publish/files/db2/Dockerfile rename to dev/io.openliberty.org.testcontainers/resources/openliberty/testcontainers/db2-krb5/12.1.0.0/Dockerfile index 3f5a137a7ae9..ac3a7ae6489e 100644 --- a/dev/com.ibm.ws.jdbc_fat_krb5/publish/files/db2/Dockerfile +++ b/dev/io.openliberty.org.testcontainers/resources/openliberty/testcontainers/db2-krb5/12.1.0.0/Dockerfile @@ -1,13 +1,15 @@ -# TODO update to use icr.io/db2_community/db2:11.5.9.0 +# Base image used by external users is overwritten at runtime +# by a mirrored version from Artifactory for internal users. -FROM ibmcom/db2:11.5.7.0 +ARG BASE_IMAGE="icr.io/db2_community/db2:12.1.0.0" -#Contains vulnerable log4j library for features not needed for kerberos -RUN rm -rf /opt/ibm/db2/V11.5/federation -RUN rm -rf /opt/ibm/db2/V11.5/db2tss +FROM ${BASE_IMAGE} -RUN yum update -y -RUN yum -y install krb5-workstation krb5-libs krb5-auth-dialog +RUN yum -y update + +# TODO 'krb5-auth-dialog' is no longer available from package managers +# that are configured on DB2 image. If needed download directly. +RUN yum -y install krb5-workstation krb5-libs ADD docker-entrypoint.sh / RUN chmod a+x /docker-entrypoint.sh @@ -28,5 +30,3 @@ RUN printf 'add_entry -password -p db2srvc@EXAMPLE.COM -k 1 -e aes256-cts\npassw RUN printf 'add_entry -password -p db2inst1@EXAMPLE.COM -k 1 -e aes256-cts\npassword\nwkt /etc/krb5.keytab' | ktutil ENTRYPOINT ["/docker-entrypoint.sh"] - -# Currently tagged in DockerHub as: kyleaure/db2-krb5:2.0 diff --git a/dev/com.ibm.ws.jdbc_fat_krb5/publish/files/db2/docker-entrypoint.sh b/dev/io.openliberty.org.testcontainers/resources/openliberty/testcontainers/db2-krb5/12.1.0.0/docker-entrypoint.sh similarity index 100% rename from dev/com.ibm.ws.jdbc_fat_krb5/publish/files/db2/docker-entrypoint.sh rename to dev/io.openliberty.org.testcontainers/resources/openliberty/testcontainers/db2-krb5/12.1.0.0/docker-entrypoint.sh diff --git a/dev/com.ibm.ws.jdbc_fat_krb5/publish/files/db2/files/krb5.conf b/dev/io.openliberty.org.testcontainers/resources/openliberty/testcontainers/db2-krb5/12.1.0.0/files/krb5.conf similarity index 100% rename from dev/com.ibm.ws.jdbc_fat_krb5/publish/files/db2/files/krb5.conf rename to dev/io.openliberty.org.testcontainers/resources/openliberty/testcontainers/db2-krb5/12.1.0.0/files/krb5.conf diff --git a/dev/com.ibm.ws.jdbc_fat_krb5/publish/files/db2/var/custom/createschema.sh b/dev/io.openliberty.org.testcontainers/resources/openliberty/testcontainers/db2-krb5/12.1.0.0/var/custom/createschema.sh similarity index 100% rename from dev/com.ibm.ws.jdbc_fat_krb5/publish/files/db2/var/custom/createschema.sh rename to dev/io.openliberty.org.testcontainers/resources/openliberty/testcontainers/db2-krb5/12.1.0.0/var/custom/createschema.sh diff --git a/dev/com.ibm.ws.jdbc_fat_db2/publish/files/db2-ssl/Dockerfile b/dev/io.openliberty.org.testcontainers/resources/openliberty/testcontainers/db2-ssl/11.5.9.0/Dockerfile similarity index 65% rename from dev/com.ibm.ws.jdbc_fat_db2/publish/files/db2-ssl/Dockerfile rename to dev/io.openliberty.org.testcontainers/resources/openliberty/testcontainers/db2-ssl/11.5.9.0/Dockerfile index 080afb637dc2..9d38b205bd9e 100644 --- a/dev/com.ibm.ws.jdbc_fat_db2/publish/files/db2-ssl/Dockerfile +++ b/dev/io.openliberty.org.testcontainers/resources/openliberty/testcontainers/db2-ssl/11.5.9.0/Dockerfile @@ -1,10 +1,9 @@ -# TODO update to use icr.io/db2_community/db2:11.5.9.0 +# Base image used by external users is overwritten at runtime +# by a mirrored version from Artifactory for internal users. -FROM ibmcom/db2:11.5.7.0 +ARG BASE_IMAGE="icr.io/db2_community/db2:11.5.9.0" -#Contains vulnerable log4j library for features not needed for SSL -RUN rm -rf /opt/ibm/db2/V11.5/federation -RUN rm -rf /opt/ibm/db2/V11.5/db2tss +FROM ${BASE_IMAGE} # Copy custom startup script that will run when server starts COPY custom/ /var/custom/ @@ -28,4 +27,3 @@ ENV ARCHIVE_LOGS=false # Expose new port EXPOSE 50001 -# Currently tagged in DockerHub as: kyleaure/db2-ssl:3.0 diff --git a/dev/com.ibm.ws.jdbc_fat_db2/publish/files/db2-ssl/custom/db2_tls_setup.sh b/dev/io.openliberty.org.testcontainers/resources/openliberty/testcontainers/db2-ssl/11.5.9.0/custom/db2_tls_setup.sh similarity index 100% rename from dev/com.ibm.ws.jdbc_fat_db2/publish/files/db2-ssl/custom/db2_tls_setup.sh rename to dev/io.openliberty.org.testcontainers/resources/openliberty/testcontainers/db2-ssl/11.5.9.0/custom/db2_tls_setup.sh diff --git a/dev/com.ibm.ws.jdbc_fat_db2/publish/files/db2-ssl/setup/enable-ssl.sh b/dev/io.openliberty.org.testcontainers/resources/openliberty/testcontainers/db2-ssl/11.5.9.0/setup/enable-ssl.sh similarity index 100% rename from dev/com.ibm.ws.jdbc_fat_db2/publish/files/db2-ssl/setup/enable-ssl.sh rename to dev/io.openliberty.org.testcontainers/resources/openliberty/testcontainers/db2-ssl/11.5.9.0/setup/enable-ssl.sh diff --git a/dev/io.openliberty.org.testcontainers/resources/openliberty/testcontainers/kdc-jdbc-server/3.17/Dockerfile b/dev/io.openliberty.org.testcontainers/resources/openliberty/testcontainers/kdc-jdbc-server/3.17/Dockerfile new file mode 100644 index 000000000000..b2d90ba09c01 --- /dev/null +++ b/dev/io.openliberty.org.testcontainers/resources/openliberty/testcontainers/kdc-jdbc-server/3.17/Dockerfile @@ -0,0 +1,20 @@ +# Base image used by external users is overwritten at runtime +# by a mirrored version from Artifactory for internal users. + +ARG BASE_IMAGE="public.ecr.aws/docker/library/alpine:3.17" + +FROM ${BASE_IMAGE} + +# Install Kerberos +RUN apk add --no-cache krb5-server krb5 supervisor tini + +# Copy configuration and entrypoint +COPY supervisord.conf /etc/supervisord.conf +COPY docker-entrypoint.sh / + +# Expose ports +EXPOSE 749 464 88 + +# Entrypoint and command +ENTRYPOINT ["/sbin/tini", "--"] +CMD ["/docker-entrypoint.sh"] diff --git a/dev/com.ibm.ws.jdbc_fat_krb5/publish/files/kdc-server/docker-entrypoint.sh b/dev/io.openliberty.org.testcontainers/resources/openliberty/testcontainers/kdc-jdbc-server/3.17/docker-entrypoint.sh similarity index 100% rename from dev/com.ibm.ws.jdbc_fat_krb5/publish/files/kdc-server/docker-entrypoint.sh rename to dev/io.openliberty.org.testcontainers/resources/openliberty/testcontainers/kdc-jdbc-server/3.17/docker-entrypoint.sh diff --git a/dev/io.openliberty.org.testcontainers/resources/openliberty/testcontainers/kdc-jdbc-server/3.17/supervisord.conf b/dev/io.openliberty.org.testcontainers/resources/openliberty/testcontainers/kdc-jdbc-server/3.17/supervisord.conf new file mode 100644 index 000000000000..dba90c67c10d --- /dev/null +++ b/dev/io.openliberty.org.testcontainers/resources/openliberty/testcontainers/kdc-jdbc-server/3.17/supervisord.conf @@ -0,0 +1,34 @@ +; See configuration syntax here +; https://supervisord.org/configuration.html + +[inet_http_server] +port=9001 + +[rpcinterface:supervisor] +supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface + +[supervisorctl] +serverurl = http://127.0.0.1:9001 + +[program:krb5kdc] +command = /usr/sbin/krb5kdc -n +startretries = 1 +startsecs = 5 +stdout_logfile=/dev/stdout +stdout_logfile_maxbytes=0 + +[program:kadmind] +command = /usr/sbin/kadmind -nofork +startretries = 1 +startsecs = 5 +stdout_logfile=/dev/stdout +stdout_logfile_maxbytes=0 + + +[supervisord] +logfile = /tmp/supervisord_zbx_server.log +loglevel = critical +nodaemon = true +user = root +pidfile = /tmp/supervisord_zbx_server.pid +directory = /tmp \ No newline at end of file diff --git a/dev/io.openliberty.org.testcontainers/resources/openliberty/testcontainers/kdc-security-server/3.17/Dockerfile b/dev/io.openliberty.org.testcontainers/resources/openliberty/testcontainers/kdc-security-server/3.17/Dockerfile new file mode 100644 index 000000000000..b2d90ba09c01 --- /dev/null +++ b/dev/io.openliberty.org.testcontainers/resources/openliberty/testcontainers/kdc-security-server/3.17/Dockerfile @@ -0,0 +1,20 @@ +# Base image used by external users is overwritten at runtime +# by a mirrored version from Artifactory for internal users. + +ARG BASE_IMAGE="public.ecr.aws/docker/library/alpine:3.17" + +FROM ${BASE_IMAGE} + +# Install Kerberos +RUN apk add --no-cache krb5-server krb5 supervisor tini + +# Copy configuration and entrypoint +COPY supervisord.conf /etc/supervisord.conf +COPY docker-entrypoint.sh / + +# Expose ports +EXPOSE 749 464 88 + +# Entrypoint and command +ENTRYPOINT ["/sbin/tini", "--"] +CMD ["/docker-entrypoint.sh"] diff --git a/dev/com.ibm.ws.security.wim.adapter.ldap_fat.krb5.1/publish/files/kdc-server/docker-entrypoint.sh b/dev/io.openliberty.org.testcontainers/resources/openliberty/testcontainers/kdc-security-server/3.17/docker-entrypoint.sh similarity index 100% rename from dev/com.ibm.ws.security.wim.adapter.ldap_fat.krb5.1/publish/files/kdc-server/docker-entrypoint.sh rename to dev/io.openliberty.org.testcontainers/resources/openliberty/testcontainers/kdc-security-server/3.17/docker-entrypoint.sh diff --git a/dev/io.openliberty.org.testcontainers/resources/openliberty/testcontainers/kdc-security-server/3.17/supervisord.conf b/dev/io.openliberty.org.testcontainers/resources/openliberty/testcontainers/kdc-security-server/3.17/supervisord.conf new file mode 100644 index 000000000000..dba90c67c10d --- /dev/null +++ b/dev/io.openliberty.org.testcontainers/resources/openliberty/testcontainers/kdc-security-server/3.17/supervisord.conf @@ -0,0 +1,34 @@ +; See configuration syntax here +; https://supervisord.org/configuration.html + +[inet_http_server] +port=9001 + +[rpcinterface:supervisor] +supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface + +[supervisorctl] +serverurl = http://127.0.0.1:9001 + +[program:krb5kdc] +command = /usr/sbin/krb5kdc -n +startretries = 1 +startsecs = 5 +stdout_logfile=/dev/stdout +stdout_logfile_maxbytes=0 + +[program:kadmind] +command = /usr/sbin/kadmind -nofork +startretries = 1 +startsecs = 5 +stdout_logfile=/dev/stdout +stdout_logfile_maxbytes=0 + + +[supervisord] +logfile = /tmp/supervisord_zbx_server.log +loglevel = critical +nodaemon = true +user = root +pidfile = /tmp/supervisord_zbx_server.pid +directory = /tmp \ No newline at end of file diff --git a/dev/io.openliberty.org.testcontainers/resources/openliberty/testcontainers/keyserver-simple/3.11.6/Dockerfile b/dev/io.openliberty.org.testcontainers/resources/openliberty/testcontainers/keyserver-simple/3.11.6/Dockerfile new file mode 100644 index 000000000000..84a6e6ecc900 --- /dev/null +++ b/dev/io.openliberty.org.testcontainers/resources/openliberty/testcontainers/keyserver-simple/3.11.6/Dockerfile @@ -0,0 +1,14 @@ +# Base image used by external users is overwritten at runtime +# by a mirrored version from Artifactory for internal users. + +ARG BASE_IMAGE="public.ecr.aws/docker/library/python:3.11.6" + +FROM ${BASE_IMAGE} + +WORKDIR /public_key + +COPY public_key/validKey.asc validKey.asc + +EXPOSE 8080 + +CMD ["python", "-m" , "http.server", "8080"] diff --git a/dev/io.openliberty.org.testcontainers/resources/openliberty/testcontainers/keyserver-simple/3.11.6/public_key/validKey.asc b/dev/io.openliberty.org.testcontainers/resources/openliberty/testcontainers/keyserver-simple/3.11.6/public_key/validKey.asc new file mode 100644 index 000000000000..5a4ddb4acfd3 --- /dev/null +++ b/dev/io.openliberty.org.testcontainers/resources/openliberty/testcontainers/keyserver-simple/3.11.6/public_key/validKey.asc @@ -0,0 +1,11 @@ +-----BEGIN PGP PUBLIC KEY BLOCK----- +Comment: Hostname: +Version: Hockeypuck 2.1.0-222-g25248d4 + +xjMEY+1Y6RYJKwYBBAHaRw8BAQdAzgcyMvreUdoUXYofjC+mCm1dW9IaPs+nx9rF +dc4mKFLOOARj7VjpEgorBgEEAZdVAQUBAQdA52rgXKV5cdmIqXhIhUvT/Hvktcyy +kKdqt/YJX5GY1CYDAQgHwngEGBYKACACGwwWIQQQyeYjPrW9z8ApyzBx+OYjm2g0 +qgUCY+1ZowAKCRBx+OYjm2g0qtuIAQD64SWKyMBtvr8TZT91mIAsMV+npF58B3v0 +tNyeDipYJQEA74mtwWh9R7i7+7b3jsxFEMSzu8ZbTk25qSIlQLmE9wM= +=G+gC +-----END PGP PUBLIC KEY BLOCK----- diff --git a/dev/com.ibm.ws.security.wim.adapter.ldap_fat.krb5.1/publish/files/ldap-server/Dockerfile b/dev/io.openliberty.org.testcontainers/resources/openliberty/testcontainers/ldap-server/3.17/Dockerfile similarity index 73% rename from dev/com.ibm.ws.security.wim.adapter.ldap_fat.krb5.1/publish/files/ldap-server/Dockerfile rename to dev/io.openliberty.org.testcontainers/resources/openliberty/testcontainers/ldap-server/3.17/Dockerfile index b5ec78220d5c..0fcfd82b91b1 100644 --- a/dev/com.ibm.ws.security.wim.adapter.ldap_fat.krb5.1/publish/files/ldap-server/Dockerfile +++ b/dev/io.openliberty.org.testcontainers/resources/openliberty/testcontainers/ldap-server/3.17/Dockerfile @@ -1,5 +1,9 @@ -# This is a base alpine(linux) image -FROM alpine:3.19 +# Base image used by external users is overwritten at runtime +# by a mirrored version from Artifactory for internal users. + +ARG BASE_IMAGE="public.ecr.aws/docker/library/alpine:3.17" + +FROM ${BASE_IMAGE} RUN apk add openldap-clients openldap-back-mdb openldap krb5-server krb5 cyrus-sasl-gssapiv2 supervisor tini @@ -18,8 +22,3 @@ COPY config_files/slapd.ldif /etc/openldap/ ENTRYPOINT ["/sbin/tini", "--"] RUN ["chmod", "+x", "/docker-entrypoint.sh"] CMD ["/docker-entrypoint.sh"] - - - - -# Currently tagged in DockerHub as: zachhein/ldap-server:0.5 diff --git a/dev/com.ibm.ws.security.wim.adapter.ldap_fat.krb5.1/publish/files/ldap-server/config_files/admin.keyfile b/dev/io.openliberty.org.testcontainers/resources/openliberty/testcontainers/ldap-server/3.17/config_files/admin.keyfile similarity index 100% rename from dev/com.ibm.ws.security.wim.adapter.ldap_fat.krb5.1/publish/files/ldap-server/config_files/admin.keyfile rename to dev/io.openliberty.org.testcontainers/resources/openliberty/testcontainers/ldap-server/3.17/config_files/admin.keyfile diff --git a/dev/com.ibm.ws.security.wim.adapter.ldap_fat.krb5.1/publish/files/ldap-server/config_files/full_example_com.ldif b/dev/io.openliberty.org.testcontainers/resources/openliberty/testcontainers/ldap-server/3.17/config_files/full_example_com.ldif similarity index 100% rename from dev/com.ibm.ws.security.wim.adapter.ldap_fat.krb5.1/publish/files/ldap-server/config_files/full_example_com.ldif rename to dev/io.openliberty.org.testcontainers/resources/openliberty/testcontainers/ldap-server/3.17/config_files/full_example_com.ldif diff --git a/dev/com.ibm.ws.security.wim.adapter.ldap_fat.krb5.1/publish/files/ldap-server/config_files/kerberos.openldap.ldif b/dev/io.openliberty.org.testcontainers/resources/openliberty/testcontainers/ldap-server/3.17/config_files/kerberos.openldap.ldif similarity index 100% rename from dev/com.ibm.ws.security.wim.adapter.ldap_fat.krb5.1/publish/files/ldap-server/config_files/kerberos.openldap.ldif rename to dev/io.openliberty.org.testcontainers/resources/openliberty/testcontainers/ldap-server/3.17/config_files/kerberos.openldap.ldif diff --git a/dev/com.ibm.ws.security.wim.adapter.ldap_fat.krb5.1/publish/files/ldap-server/config_files/ldap.conf b/dev/io.openliberty.org.testcontainers/resources/openliberty/testcontainers/ldap-server/3.17/config_files/ldap.conf similarity index 100% rename from dev/com.ibm.ws.security.wim.adapter.ldap_fat.krb5.1/publish/files/ldap-server/config_files/ldap.conf rename to dev/io.openliberty.org.testcontainers/resources/openliberty/testcontainers/ldap-server/3.17/config_files/ldap.conf diff --git a/dev/com.ibm.ws.security.wim.adapter.ldap_fat.krb5.1/publish/files/ldap-server/config_files/slapd.ldif b/dev/io.openliberty.org.testcontainers/resources/openliberty/testcontainers/ldap-server/3.17/config_files/slapd.ldif similarity index 100% rename from dev/com.ibm.ws.security.wim.adapter.ldap_fat.krb5.1/publish/files/ldap-server/config_files/slapd.ldif rename to dev/io.openliberty.org.testcontainers/resources/openliberty/testcontainers/ldap-server/3.17/config_files/slapd.ldif diff --git a/dev/com.ibm.ws.security.wim.adapter.ldap_fat.krb5.1/publish/files/ldap-server/docker-entrypoint.sh b/dev/io.openliberty.org.testcontainers/resources/openliberty/testcontainers/ldap-server/3.17/docker-entrypoint.sh similarity index 100% rename from dev/com.ibm.ws.security.wim.adapter.ldap_fat.krb5.1/publish/files/ldap-server/docker-entrypoint.sh rename to dev/io.openliberty.org.testcontainers/resources/openliberty/testcontainers/ldap-server/3.17/docker-entrypoint.sh diff --git a/dev/com.ibm.ws.security.wim.adapter.ldap_fat.krb5.1/publish/files/ldap-server/supervisord.conf b/dev/io.openliberty.org.testcontainers/resources/openliberty/testcontainers/ldap-server/3.17/supervisord.conf similarity index 100% rename from dev/com.ibm.ws.security.wim.adapter.ldap_fat.krb5.1/publish/files/ldap-server/supervisord.conf rename to dev/io.openliberty.org.testcontainers/resources/openliberty/testcontainers/ldap-server/3.17/supervisord.conf diff --git a/dev/com.ibm.ws.jdbc_fat_krb5/publish/files/oracle/Dockerfile b/dev/io.openliberty.org.testcontainers/resources/openliberty/testcontainers/oracle-krb5/23.5-full-faststart/Dockerfile similarity index 84% rename from dev/com.ibm.ws.jdbc_fat_krb5/publish/files/oracle/Dockerfile rename to dev/io.openliberty.org.testcontainers/resources/openliberty/testcontainers/oracle-krb5/23.5-full-faststart/Dockerfile index 4e08e161f775..183b609bc8e0 100644 --- a/dev/com.ibm.ws.jdbc_fat_krb5/publish/files/oracle/Dockerfile +++ b/dev/io.openliberty.org.testcontainers/resources/openliberty/testcontainers/oracle-krb5/23.5-full-faststart/Dockerfile @@ -1,5 +1,9 @@ -# TODO update to ghcr.io/gvenzl/oracle-free:23.5-full-faststart -FROM gvenzl/oracle-xe:21.3.0-full-faststart +# Base image used by external users is overwritten at runtime +# by a mirrored version from Artifactory for internal users. + +ARG BASE_IMAGE="ghcr.io/gvenzl/oracle-free:23.5-full-faststart" + +FROM ${BASE_IMAGE} # Update and install Kerberos (server head) USER root @@ -32,5 +36,3 @@ RUN rm /opt/oracle/scripts/setup/1kerberos.sh RUN rm /opt/oracle/scripts/setup/2oracle.sh USER oracle - -# Currently tagged in DockerHub as: kyleaure/oracle-21.3.0-faststart:1.0.full.krb5 diff --git a/dev/com.ibm.ws.jdbc_fat_krb5/publish/files/oracle/setup/1kerberos.sh b/dev/io.openliberty.org.testcontainers/resources/openliberty/testcontainers/oracle-krb5/23.5-full-faststart/setup/1kerberos.sh similarity index 100% rename from dev/com.ibm.ws.jdbc_fat_krb5/publish/files/oracle/setup/1kerberos.sh rename to dev/io.openliberty.org.testcontainers/resources/openliberty/testcontainers/oracle-krb5/23.5-full-faststart/setup/1kerberos.sh diff --git a/dev/com.ibm.ws.jdbc_fat_krb5/publish/files/oracle/setup/2oracle.sh b/dev/io.openliberty.org.testcontainers/resources/openliberty/testcontainers/oracle-krb5/23.5-full-faststart/setup/2oracle.sh similarity index 100% rename from dev/com.ibm.ws.jdbc_fat_krb5/publish/files/oracle/setup/2oracle.sh rename to dev/io.openliberty.org.testcontainers/resources/openliberty/testcontainers/oracle-krb5/23.5-full-faststart/setup/2oracle.sh diff --git a/dev/com.ibm.ws.jdbc_fat_krb5/publish/files/oracle/startup/01_kerberos.sh b/dev/io.openliberty.org.testcontainers/resources/openliberty/testcontainers/oracle-krb5/23.5-full-faststart/startup/01_kerberos.sh similarity index 100% rename from dev/com.ibm.ws.jdbc_fat_krb5/publish/files/oracle/startup/01_kerberos.sh rename to dev/io.openliberty.org.testcontainers/resources/openliberty/testcontainers/oracle-krb5/23.5-full-faststart/startup/01_kerberos.sh diff --git a/dev/com.ibm.ws.jdbc_fat_krb5/publish/files/oracle/startup/02_oracle.sql b/dev/io.openliberty.org.testcontainers/resources/openliberty/testcontainers/oracle-krb5/23.5-full-faststart/startup/02_oracle.sql similarity index 100% rename from dev/com.ibm.ws.jdbc_fat_krb5/publish/files/oracle/startup/02_oracle.sql rename to dev/io.openliberty.org.testcontainers/resources/openliberty/testcontainers/oracle-krb5/23.5-full-faststart/startup/02_oracle.sql diff --git a/dev/com.ibm.ws.jdbc_fat_oracle/publish/files/oracle-ssl/Dockerfile b/dev/io.openliberty.org.testcontainers/resources/openliberty/testcontainers/oracle-ssl/23.5-full-faststart/Dockerfile similarity index 64% rename from dev/com.ibm.ws.jdbc_fat_oracle/publish/files/oracle-ssl/Dockerfile rename to dev/io.openliberty.org.testcontainers/resources/openliberty/testcontainers/oracle-ssl/23.5-full-faststart/Dockerfile index d177bf7655de..c86e223c8aeb 100644 --- a/dev/com.ibm.ws.jdbc_fat_oracle/publish/files/oracle-ssl/Dockerfile +++ b/dev/io.openliberty.org.testcontainers/resources/openliberty/testcontainers/oracle-ssl/23.5-full-faststart/Dockerfile @@ -1,5 +1,9 @@ -# TODO update to ghcr.io/gvenzl/oracle-free:23.5-full-faststart -FROM gvenzl/oracle-xe:21.3.0-full-faststart +# Base image used by external users is overwritten at runtime +# by a mirrored version from Artifactory for internal users. + +ARG BASE_IMAGE="ghcr.io/gvenzl/oracle-free:23.5-full-faststart" + +FROM ${BASE_IMAGE} COPY setup/ /tmp/setup/ COPY startup/ /container-entrypoint-startdb.d @@ -16,5 +20,3 @@ RUN rm -rf /tmp/setup USER oracle EXPOSE 1522 - -# Currently tagged in DockerHub as: kyleaure/oracle-21.3.0-faststart:1.0.full.ssl diff --git a/dev/com.ibm.ws.jdbc_fat_oracle/publish/files/oracle-ssl/setup/enable_ssl.sh b/dev/io.openliberty.org.testcontainers/resources/openliberty/testcontainers/oracle-ssl/23.5-full-faststart/setup/enable_ssl.sh similarity index 95% rename from dev/com.ibm.ws.jdbc_fat_oracle/publish/files/oracle-ssl/setup/enable_ssl.sh rename to dev/io.openliberty.org.testcontainers/resources/openliberty/testcontainers/oracle-ssl/23.5-full-faststart/setup/enable_ssl.sh index 8eea14e043c5..59b6bc1d3164 100644 --- a/dev/com.ibm.ws.jdbc_fat_oracle/publish/files/oracle-ssl/setup/enable_ssl.sh +++ b/dev/io.openliberty.org.testcontainers/resources/openliberty/testcontainers/oracle-ssl/23.5-full-faststart/setup/enable_ssl.sh @@ -56,15 +56,20 @@ chown -R oracle:oinstall $CLIENT_WALLET # PART 4: Create JKS wallet from oracle wallet echo "START >>> Create JKS wallet" -CLIENT_KEYSTORE="/client/oracle/store/client-keystore.jks" -CLIENT_TRUSTSTORE="/client/oracle/store/client-truststore.jks" -mkdir -p /client/oracle/store +CLIENT_STORE="/client/oracle/store" +CLIENT_KEYSTORE="$CLIENT_STORE/client-keystore.jks" +CLIENT_TRUSTSTORE="$CLIENT_STORE/client-truststore.jks" +mkdir -p $CLIENT_STORE orapki wallet pkcs12_to_jks \ -wallet $CLIENT_WALLET/ewallet.p12 -pwd $WALLET_PWD \ -jksKeyStoreLoc $CLIENT_KEYSTORE -jksKeyStorepwd $WALLET_PWD \ -jksTrustStoreLoc $CLIENT_TRUSTSTORE -jksTrustStorepwd $WALLET_PWD echo "DONE >>> Create JKS wallet" +# PART 4.1: Modify readability of client files +chmod -R 775 $CLIENT_WALLET +chmod -R 775 $CLIENT_STORE + # PART 5: Configure server network ## Overwrite to sqlnet.ora SQLNET=$ORACLE_ADMIN/sqlnet.ora diff --git a/dev/com.ibm.ws.jdbc_fat_oracle/publish/files/oracle-ssl/startup/startup.sql b/dev/io.openliberty.org.testcontainers/resources/openliberty/testcontainers/oracle-ssl/23.5-full-faststart/startup/startup.sql similarity index 100% rename from dev/com.ibm.ws.jdbc_fat_oracle/publish/files/oracle-ssl/startup/startup.sql rename to dev/io.openliberty.org.testcontainers/resources/openliberty/testcontainers/oracle-ssl/23.5-full-faststart/startup/startup.sql diff --git a/dev/io.openliberty.org.testcontainers/resources/openliberty/testcontainers/postgres-init/17.0-alpine/Dockerfile b/dev/io.openliberty.org.testcontainers/resources/openliberty/testcontainers/postgres-init/17.0-alpine/Dockerfile new file mode 100644 index 000000000000..94e8959ce532 --- /dev/null +++ b/dev/io.openliberty.org.testcontainers/resources/openliberty/testcontainers/postgres-init/17.0-alpine/Dockerfile @@ -0,0 +1,10 @@ +# Base image used by external users is overwritten at runtime +# by a mirrored version from Artifactory for internal users. + +ARG BASE_IMAGE="public.ecr.aws/docker/library/postgres:17.0-alpine" + +FROM ${BASE_IMAGE} + +COPY scripts/initDB.sql /docker-entrypoint-initdb.d/initDB.sql + +RUN chown postgres /docker-entrypoint-initdb.d/initDB.sql && chmod 600 /docker-entrypoint-initdb.d/initDB.sql diff --git a/dev/build.example.testcontainers_fat/publish/files/postgres/scripts/initDB.sql b/dev/io.openliberty.org.testcontainers/resources/openliberty/testcontainers/postgres-init/17.0-alpine/scripts/initDB.sql similarity index 100% rename from dev/build.example.testcontainers_fat/publish/files/postgres/scripts/initDB.sql rename to dev/io.openliberty.org.testcontainers/resources/openliberty/testcontainers/postgres-init/17.0-alpine/scripts/initDB.sql diff --git a/dev/com.ibm.ws.jdbc_fat_krb5/publish/files/postgresql/Dockerfile b/dev/io.openliberty.org.testcontainers/resources/openliberty/testcontainers/postgres-krb5/17.0/Dockerfile similarity index 84% rename from dev/com.ibm.ws.jdbc_fat_krb5/publish/files/postgresql/Dockerfile rename to dev/io.openliberty.org.testcontainers/resources/openliberty/testcontainers/postgres-krb5/17.0/Dockerfile index 7eb0f617df87..f277631007de 100644 --- a/dev/com.ibm.ws.jdbc_fat_krb5/publish/files/postgresql/Dockerfile +++ b/dev/io.openliberty.org.testcontainers/resources/openliberty/testcontainers/postgres-krb5/17.0/Dockerfile @@ -1,6 +1,9 @@ -# TODO update to public.ecr.aws/docker/library/postgres:17.0-alpine +# Base image used by external users is overwritten at runtime +# by a mirrored version from Artifactory for internal users. -FROM postgres:12.4 +ARG BASE_IMAGE="public.ecr.aws/docker/library/postgres:17.0" + +FROM ${BASE_IMAGE} RUN set -ex; \ echo krb5-config krb5-config/default_realm string LOCALDOMAIN | debconf-set-selections; \ @@ -27,7 +30,3 @@ RUN chmod 777 /etc/krb5.keytab ADD startup/db_setup.sh /docker-entrypoint-initdb.d/db_setup.sh RUN chmod 777 /docker-entrypoint-initdb.d/db_setup.sh - - - -# Currently tagged in DockerHub as: kyleaure/postgres-krb5:1.0 diff --git a/dev/com.ibm.ws.jdbc_fat_krb5/publish/files/postgresql/files/krb5.conf b/dev/io.openliberty.org.testcontainers/resources/openliberty/testcontainers/postgres-krb5/17.0/files/krb5.conf similarity index 100% rename from dev/com.ibm.ws.jdbc_fat_krb5/publish/files/postgresql/files/krb5.conf rename to dev/io.openliberty.org.testcontainers/resources/openliberty/testcontainers/postgres-krb5/17.0/files/krb5.conf diff --git a/dev/com.ibm.ws.jdbc_fat_krb5/publish/files/postgresql/startup/db_setup.sh b/dev/io.openliberty.org.testcontainers/resources/openliberty/testcontainers/postgres-krb5/17.0/startup/db_setup.sh similarity index 100% rename from dev/com.ibm.ws.jdbc_fat_krb5/publish/files/postgresql/startup/db_setup.sh rename to dev/io.openliberty.org.testcontainers/resources/openliberty/testcontainers/postgres-krb5/17.0/startup/db_setup.sh diff --git a/dev/com.ibm.ws.jdbc_fat_postgresql/publish/files/postgresql-ssl/Dockerfile b/dev/io.openliberty.org.testcontainers/resources/openliberty/testcontainers/postgres-ssl/17.0-alpine/Dockerfile similarity index 63% rename from dev/com.ibm.ws.jdbc_fat_postgresql/publish/files/postgresql-ssl/Dockerfile rename to dev/io.openliberty.org.testcontainers/resources/openliberty/testcontainers/postgres-ssl/17.0-alpine/Dockerfile index 1d98af8a887c..7dffd02e445d 100644 --- a/dev/com.ibm.ws.jdbc_fat_postgresql/publish/files/postgresql-ssl/Dockerfile +++ b/dev/io.openliberty.org.testcontainers/resources/openliberty/testcontainers/postgres-ssl/17.0-alpine/Dockerfile @@ -1,6 +1,9 @@ -# TODO update to public.ecr.aws/docker/library/postgres:17.0-alpine +# Base image used by external users is overwritten at runtime +# by a mirrored version from Artifactory for internal users. -FROM postgres:14.1-alpine +ARG BASE_IMAGE="public.ecr.aws/docker/library/postgres:17.0-alpine" + +FROM ${BASE_IMAGE} COPY ssl-certs/server.crt /var/lib/postgresql/server.crt COPY ssl-certs/server.key /var/lib/postgresql/server.key diff --git a/dev/com.ibm.ws.jdbc_fat_postgresql/publish/files/postgresql-ssl/ssl-certs/privkey.pem b/dev/io.openliberty.org.testcontainers/resources/openliberty/testcontainers/postgres-ssl/17.0-alpine/ssl-certs/privkey.pem similarity index 100% rename from dev/com.ibm.ws.jdbc_fat_postgresql/publish/files/postgresql-ssl/ssl-certs/privkey.pem rename to dev/io.openliberty.org.testcontainers/resources/openliberty/testcontainers/postgres-ssl/17.0-alpine/ssl-certs/privkey.pem diff --git a/dev/com.ibm.ws.jdbc_fat_postgresql/publish/files/postgresql-ssl/ssl-certs/server.crt b/dev/io.openliberty.org.testcontainers/resources/openliberty/testcontainers/postgres-ssl/17.0-alpine/ssl-certs/server.crt similarity index 100% rename from dev/com.ibm.ws.jdbc_fat_postgresql/publish/files/postgresql-ssl/ssl-certs/server.crt rename to dev/io.openliberty.org.testcontainers/resources/openliberty/testcontainers/postgres-ssl/17.0-alpine/ssl-certs/server.crt diff --git a/dev/com.ibm.ws.jdbc_fat_postgresql/publish/files/postgresql-ssl/ssl-certs/server.key b/dev/io.openliberty.org.testcontainers/resources/openliberty/testcontainers/postgres-ssl/17.0-alpine/ssl-certs/server.key similarity index 100% rename from dev/com.ibm.ws.jdbc_fat_postgresql/publish/files/postgresql-ssl/ssl-certs/server.key rename to dev/io.openliberty.org.testcontainers/resources/openliberty/testcontainers/postgres-ssl/17.0-alpine/ssl-certs/server.key diff --git a/dev/com.ibm.ws.jdbc_fat_postgresql/publish/files/postgresql-ssl/ssl-certs/server.req b/dev/io.openliberty.org.testcontainers/resources/openliberty/testcontainers/postgres-ssl/17.0-alpine/ssl-certs/server.req similarity index 100% rename from dev/com.ibm.ws.jdbc_fat_postgresql/publish/files/postgresql-ssl/ssl-certs/server.req rename to dev/io.openliberty.org.testcontainers/resources/openliberty/testcontainers/postgres-ssl/17.0-alpine/ssl-certs/server.req diff --git a/dev/io.openliberty.org.testcontainers/resources/openliberty/testcontainers/sqlserver-ssl/2019-CU28-ubuntu-20.04/Dockerfile b/dev/io.openliberty.org.testcontainers/resources/openliberty/testcontainers/sqlserver-ssl/2019-CU28-ubuntu-20.04/Dockerfile new file mode 100644 index 000000000000..0c0de4296c32 --- /dev/null +++ b/dev/io.openliberty.org.testcontainers/resources/openliberty/testcontainers/sqlserver-ssl/2019-CU28-ubuntu-20.04/Dockerfile @@ -0,0 +1,12 @@ +# Base image used by external users is overwritten at runtime +# by a mirrored version from Artifactory for internal users. + +ARG BASE_IMAGE="mcr.microsoft.com/mssql/server:2019-CU28-ubuntu-20.04" + +FROM ${BASE_IMAGE} + +COPY --chown=mssql:0 container-files/mssql.conf /var/opt/mssql/mssql.conf +COPY --chown=mssql:0 container-files/mssql.pem /etc/ssl/certs/mssql.pem +COPY --chown=mssql:0 container-files/mssql.key /etc/ssl/mssql.key +COPY --chown=mssql:0 container-files/truststore.p12 /truststore.p12 + diff --git a/dev/com.ibm.ws.jdbc_fat_sqlserver/publish/files/sqlserver-ssl/container-files/mssql.conf b/dev/io.openliberty.org.testcontainers/resources/openliberty/testcontainers/sqlserver-ssl/2019-CU28-ubuntu-20.04/container-files/mssql.conf similarity index 100% rename from dev/com.ibm.ws.jdbc_fat_sqlserver/publish/files/sqlserver-ssl/container-files/mssql.conf rename to dev/io.openliberty.org.testcontainers/resources/openliberty/testcontainers/sqlserver-ssl/2019-CU28-ubuntu-20.04/container-files/mssql.conf diff --git a/dev/com.ibm.ws.jdbc_fat_sqlserver/publish/files/sqlserver-ssl/container-files/mssql.key b/dev/io.openliberty.org.testcontainers/resources/openliberty/testcontainers/sqlserver-ssl/2019-CU28-ubuntu-20.04/container-files/mssql.key similarity index 100% rename from dev/com.ibm.ws.jdbc_fat_sqlserver/publish/files/sqlserver-ssl/container-files/mssql.key rename to dev/io.openliberty.org.testcontainers/resources/openliberty/testcontainers/sqlserver-ssl/2019-CU28-ubuntu-20.04/container-files/mssql.key diff --git a/dev/com.ibm.ws.jdbc_fat_sqlserver/publish/files/sqlserver-ssl/container-files/mssql.pem b/dev/io.openliberty.org.testcontainers/resources/openliberty/testcontainers/sqlserver-ssl/2019-CU28-ubuntu-20.04/container-files/mssql.pem similarity index 100% rename from dev/com.ibm.ws.jdbc_fat_sqlserver/publish/files/sqlserver-ssl/container-files/mssql.pem rename to dev/io.openliberty.org.testcontainers/resources/openliberty/testcontainers/sqlserver-ssl/2019-CU28-ubuntu-20.04/container-files/mssql.pem diff --git a/dev/io.openliberty.org.testcontainers/resources/openliberty/testcontainers/sqlserver-ssl/2019-CU28-ubuntu-20.04/container-files/truststore.p12 b/dev/io.openliberty.org.testcontainers/resources/openliberty/testcontainers/sqlserver-ssl/2019-CU28-ubuntu-20.04/container-files/truststore.p12 new file mode 100644 index 000000000000..90d14456d8ee Binary files /dev/null and b/dev/io.openliberty.org.testcontainers/resources/openliberty/testcontainers/sqlserver-ssl/2019-CU28-ubuntu-20.04/container-files/truststore.p12 differ diff --git a/dev/io.openliberty.org.testcontainers/src/io/openliberty/org/testcontainers/generate/CustomImages.java b/dev/io.openliberty.org.testcontainers/src/io/openliberty/org/testcontainers/generate/CustomImages.java index ec2048bc28ec..4589a9e58583 100644 --- a/dev/io.openliberty.org.testcontainers/src/io/openliberty/org/testcontainers/generate/CustomImages.java +++ b/dev/io.openliberty.org.testcontainers/src/io/openliberty/org/testcontainers/generate/CustomImages.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2024 IBM Corporation and others. + * Copyright (c) 2024, 2025 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at @@ -12,15 +12,16 @@ *******************************************************************************/ package io.openliberty.org.testcontainers.generate; -import java.io.File; +import java.io.IOException; import java.nio.file.Files; -import java.util.Arrays; -import java.util.HashSet; +import java.nio.file.Path; +import java.nio.file.Paths; +import java.util.ArrayList; import java.util.List; -import java.util.Set; +import java.util.Map; import java.util.stream.Collectors; +import java.util.stream.Stream; -import org.testcontainers.images.RemoteDockerImage; import org.testcontainers.images.builder.ImageFromDockerfile; import org.testcontainers.utility.DockerImageName; @@ -28,6 +29,15 @@ * Allows external contributors a convenient way to build the custom images we use in our build */ public class CustomImages { + // Ensures when we look for cached images Docker doesn't attempt to reach out to docker.io + public static final String LOCAL_REGISTRY = "localhost"; + + // The repository where all Open Liberty images will be cached + public static final String REPOSITORY = "openliberty/testcontainers/"; + + // The --build-arg necessary to overwrite the default BASE_IMAGE in the Dockerfile + // with the mirrored image in artifactory + public static final String BASE_IMAGE = "BASE_IMAGE"; public static void main(String[] args) { long start = System.currentTimeMillis(); @@ -39,61 +49,124 @@ public static void main(String[] args) { //Get data from calling script String projectPath = args[0]; - // Get image list if it exists - File imageList = new File(projectPath, "cache/externals"); - if(!imageList.exists()) { - System.out.println("Could not find file: " + imageList.getAbsolutePath()); - return; - } + //Where to find instructions to build images + Path commonPath = Paths.get(projectPath, "resources", REPOSITORY); - List images = Arrays.asList(); - try { - images = Files.lines(imageList.toPath()) - .filter(line -> !line.startsWith("#")) - .map(line -> DockerImageName.parse(line)) - .collect(Collectors.toList()); - } catch (Exception e) { - System.out.println("Could not read file: " + imageList.getAbsolutePath()); - return; - } + // Construct a list of Dockerfiles + List Dockerfiles = findDockerfiles(commonPath); + + // Construct map of docker image names to Dockerfiles + Map DockerfileMap = Dockerfiles.stream() + .collect(Collectors.toMap(Dockerfile -> constructImageName(Dockerfile, commonPath), Dockerfile -> Dockerfile)); + + // TODO Construct map of docker image names to base image names +// Map baseImageMap = DockerfileMap.entrySet().stream() +// .collect(Collectors.toMap(entry -> entry.getKey(), entry -> findBaseImage(entry.getValue()))); - // Try to pull all images in the list and generate a list of images that need to be created - final Set unpullableImageNames = new HashSet<>(images); - images.stream() - .map(name -> new RemoteDockerImage(name)) - .forEach(image -> { + // Find or build all images + for(DockerImageName name : DockerfileMap.keySet()) { + Path Dockerfile = DockerfileMap.get(name); +// DockerImageName baseImage = baseImageMap.get(name); + + ImageFromDockerfile img = new ImageFromDockerfile(name.asCanonicalNameString(), false) + .withDockerfile(Dockerfile); +// .withBuildArg(BASE_IMAGE, baseImage.asCanonicalNameString()); + try { - unpullableImageNames.remove(DockerImageName.parse(image.get())); + System.out.println("Building image: " + name.asCanonicalNameString()); + img.get(); } catch (Exception e) { - System.out.println("Could not pull image " + image.toString() + " because " + e.getMessage()); + throw new RuntimeException("Could not build or find image " + name.asCanonicalNameString(), e); } - }); - - - File dockerfiles = new File(projectPath, "dockerfiles"); - if(!dockerfiles.exists() && !dockerfiles.isDirectory()) { - System.out.println("Could not find directory: " + dockerfiles.getAbsolutePath()); - return; } - - // Try to find a Dockerfile for each unpullable image and build the image - final Set unbuildableImageNames = new HashSet<>(unpullableImageNames); - - unpullableImageNames.stream() - .map(name -> new ImageFromDockerfile(name.asCanonicalNameString(), false) - .withDockerfile( - new File(dockerfiles.getAbsolutePath(), name.getUnversionedPart() + "/" + name.getVersionPart() + "/Dockerfile").toPath())) - .forEach(image -> { - try { - unbuildableImageNames.remove(DockerImageName.parse(image.get())); - } catch (Exception e) { - System.out.println("Could not build image " + image.getDockerImageName() + " because " + e.getMessage()); - } - }); - - System.out.println("Could not pull or build " + unbuildableImageNames.size() + " image(s)"); long end = System.currentTimeMillis(); System.out.println( "Execution time in ms: " + ( end - start )); } + + /** + * Walk through all files nested within a shared path and find every Dockerfile. + * + * @param commonPath the shared path within which all Dockerfiles are nested within + * @return A list of paths to every Dockerfile + */ + private static List findDockerfiles(Path commonPath) { + final String FILE_NAME = "Dockerfile"; + final List Dockerfiles = new ArrayList<>(); + + + try (Stream paths = Files.walk(commonPath)) { + paths + .filter(Files::isRegularFile) + .filter(path -> path.getFileName().toString().endsWith(FILE_NAME)) + .forEach(Dockerfiles::add); + } catch (IOException e) { + throw new RuntimeException("Error searching files: " + e.getMessage()); + } + + return Dockerfiles; + } + + /** + * Using the Dockerfile's path, parse the directory structure to construct a + * fully qualified DockerImageName to be associated with this Dockerfile. + * + * @param Dockerfile to be built + * @param commonPath the shared path within which all Dockerfiles are nested within + * @return The DockerImageName for this Dockerfile + */ + private static DockerImageName constructImageName(Path Dockerfile, Path commonPath) { + final String fullPath = Dockerfile.toString(); + + // Find version + int end = fullPath.lastIndexOf('/'); + int start = fullPath.substring(0, end).lastIndexOf('/') + 1; + final String version = fullPath.substring(start, end); + + // Find repository + end = fullPath.indexOf(version) - 1; + start = commonPath.toString().length() + ( commonPath.toString().endsWith("/") ? 0 : 1); + final String repository = fullPath.substring(start, end); + + // Construct and return name + DockerImageName name = DockerImageName.parse(repository).withTag(version).withRegistry(LOCAL_REGISTRY); + System.out.println("Found image to build: " + name.asCanonicalNameString()); + return name; + } + + //TODO consider having a method to overwrite the BASE_IMAGE argument when running on a build system. +// /** +// * Read the Dockerfile and find the default value for the BASE_IMAGE argument. +// * Return the substituted BASE_IMAGE when run on a build system. +// * Otherwise, return the original BASE_IMAGE. +// * +// * @param Dockerfile to be built +// * @return the BASE_IMAGE (substituted or original pending environment) +// */ +// private static DockerImageName findBaseImage(Path Dockerfile) { +// final String prefix = "ARG BASE_IMAGE=\""; +// +// String argLine; +// try { +// argLine = Files.lines(Dockerfile) +// .filter(line -> line.startsWith(prefix)) +// .findFirst() +// .orElseThrow(() -> new NoSuchElementException("Could not find line that starts with " + prefix + " in file " + Dockerfile)) +// .trim(); +// } catch (IOException e) { +// throw new RuntimeException("Could not read file: " + Dockerfile.toString()); +// } +// +// String fromImgString = argLine.substring(prefix.length(), argLine.length() -1); +// +// DockerImageName original = DockerImageName.parse(fromImgString); +// DockerImageName substituted = ImageNameSubstitutor.instance().apply(original); +// +// if(!original.equals(substituted)) { +// // Substitutor was used, also prepend the registry. +// return substituted.withRegistry(System.getenv("IMAGE_NAME_PREFIX")); +// } else { +// return original; +// } +// } }