|
| 1 | +/* |
| 2 | + * Copyright (c) 2020 Philip Riecks |
| 3 | + * |
| 4 | + * See the NOTICE file(s) distributed with this work for additional |
| 5 | + * information regarding copyright ownership. |
| 6 | + * |
| 7 | + * Licensed under the Apache License, Version 2.0 (the "License"); |
| 8 | + * You may not use this file except in compliance with the License. |
| 9 | + * You may obtain a copy of the License at |
| 10 | + * |
| 11 | + * http://www.apache.org/licenses/LICENSE-2.0 |
| 12 | + * |
| 13 | + * Unless required by applicable law or agreed to in writing, software |
| 14 | + * distributed under the License is distributed on an "AS IS" BASIS, |
| 15 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 16 | + * See the License for the specific language governing permissions and |
| 17 | + * limitations under the License. |
| 18 | + */ |
| 19 | +package org.testcontainers.containers.wildfly; |
| 20 | + |
| 21 | +import org.microshed.testing.testcontainers.spi.ServerAdapter; |
| 22 | +import org.testcontainers.images.builder.ImageFromDockerfile; |
| 23 | + |
| 24 | +import java.io.File; |
| 25 | +import java.util.Optional; |
| 26 | + |
| 27 | +public class WildFlyAdapter implements ServerAdapter { |
| 28 | + |
| 29 | + @Override |
| 30 | + public int getPriority() { |
| 31 | + return PRIORITY_RUNTIME_MODULE; |
| 32 | + } |
| 33 | + |
| 34 | + @Override |
| 35 | + public int getDefaultHttpPort() { |
| 36 | + return 8080; |
| 37 | + } |
| 38 | + |
| 39 | + @Override |
| 40 | + public int getDefaultHttpsPort() { |
| 41 | + return 8443; |
| 42 | + } |
| 43 | + |
| 44 | + @Override |
| 45 | + public ImageFromDockerfile getDefaultImage(File appFile) { |
| 46 | + String appName = appFile.getName(); |
| 47 | + // Compose a docker image equivalent to doing: |
| 48 | + // FROM jboss/wildfly:18.0.1.Final |
| 49 | + // ADD target/myservice.war /opt/jboss/wildfly/standalone/deployments |
| 50 | + ImageFromDockerfile image = new ImageFromDockerfile() |
| 51 | + .withDockerfileFromBuilder(builder -> builder.from("jboss/wildfly:18.0.1.Final") |
| 52 | + .add(appName, "/opt/jboss/wildfly/standalone/deployments") |
| 53 | + .build()) |
| 54 | + .withFileFromFile(appName, appFile); |
| 55 | + return image; |
| 56 | + |
| 57 | + } |
| 58 | +} |
0 commit comments