forked from quarkus-qe/quarkus-test-suite
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request quarkus-qe#1916 from fedinskiy/feature/podman-build
Feature/podman build
- Loading branch information
Showing
15 changed files
with
192 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
<parent> | ||
<groupId>io.quarkus.ts.qe</groupId> | ||
<artifactId>parent</artifactId> | ||
<version>1.0.0-SNAPSHOT</version> | ||
<relativePath>../..</relativePath> | ||
</parent> | ||
<artifactId>podman-build</artifactId> | ||
<packaging>jar</packaging> | ||
<name>Quarkus QE TS: Podman-build</name> | ||
<properties> | ||
<quarkus.container-image.build>true</quarkus.container-image.build> | ||
</properties> | ||
<dependencies> | ||
<dependency> | ||
<groupId>io.quarkus</groupId> | ||
<artifactId>quarkus-rest-jackson</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>io.quarkus</groupId> | ||
<artifactId>quarkus-container-image-podman</artifactId> | ||
</dependency> | ||
</dependencies> | ||
<profiles> | ||
<!-- Skipped on Windows when availability of Linux containers is not explicitly declared --> | ||
<profile> | ||
<id>skip-tests-on-windows</id> | ||
<activation> | ||
<os> | ||
<family>windows</family> | ||
</os> | ||
<property> | ||
<name>!linux-containers-available</name> | ||
</property> | ||
</activation> | ||
<properties> | ||
<quarkus.container-image.build>false</quarkus.container-image.build> | ||
</properties> | ||
<build> | ||
<plugins> | ||
<plugin> | ||
<artifactId>maven-surefire-plugin</artifactId> | ||
<configuration> | ||
<skip>true</skip> | ||
</configuration> | ||
</plugin> | ||
<plugin> | ||
<artifactId>maven-failsafe-plugin</artifactId> | ||
<configuration> | ||
<skip>true</skip> | ||
</configuration> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
</profile> | ||
</profiles> | ||
</project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
#### | ||
# This Dockerfile is used in order to build a container that runs the Quarkus application in JVM mode | ||
# | ||
# Before building the container image run: | ||
# | ||
# ./mvnw package | ||
# | ||
# Then, build the image with: | ||
# | ||
# docker build -f src/main/docker/Dockerfile.jvm -t quarkus/getting-started-jvm . | ||
# | ||
# Then run the container using: | ||
# | ||
# docker run -i --rm -p 8080:8080 quarkus/getting-started-jvm | ||
# | ||
# If you want to include the debug port into your docker image | ||
# you will have to expose the debug port (default 5005) like this : EXPOSE 8080 5005 | ||
# | ||
# Then run the container using : | ||
# | ||
# docker run -i --rm -p 8080:8080 quarkus/getting-started-jvm | ||
# | ||
### | ||
FROM registry.access.redhat.com/ubi8/openjdk-17:latest | ||
|
||
ENV LANGUAGE='en_US:en' | ||
|
||
|
||
# We make four distinct layers so if there are application changes the library layers can be re-used | ||
COPY --chown=185 target/quarkus-app/lib/ /deployments/lib/ | ||
COPY --chown=185 target/quarkus-app/*.jar /deployments/ | ||
COPY --chown=185 target/quarkus-app/app/ /deployments/app/ | ||
COPY --chown=185 target/quarkus-app/quarkus/ /deployments/quarkus/ | ||
|
||
EXPOSE 8080 | ||
USER 185 | ||
ENV AB_JOLOKIA_OFF="" | ||
ENV JAVA_OPTS="-Dquarkus.http.host=0.0.0.0 -Djava.util.logging.manager=org.jboss.logmanager.LogManager" | ||
ENV JAVA_APP_JAR="/deployments/quarkus-run.jar" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
#### | ||
# This Dockerfile is used in order to build a container that runs the Quarkus application in native (no JVM) mode | ||
# | ||
# Before building the container image run: | ||
# | ||
# ./mvnw package -Pnative | ||
# | ||
# Then, build the image with: | ||
# | ||
# docker build -f src/main/docker/Dockerfile.native -t quarkus/getting-started . | ||
# | ||
# Then run the container using: | ||
# | ||
# docker run -i --rm -p 8080:8080 quarkus/getting-started | ||
# | ||
### | ||
FROM registry.access.redhat.com/ubi8/ubi-minimal:8.6 | ||
WORKDIR /work/ | ||
RUN chown 1001 /work \ | ||
&& chmod "g+rwX" /work \ | ||
&& chown 1001:root /work | ||
COPY --chown=1001:root target/*-runner /work/application | ||
EXPOSE 8080 | ||
USER 1001 | ||
CMD ["./application", "-Dquarkus.http.host=0.0.0.0"] |
16 changes: 16 additions & 0 deletions
16
build/podman/src/main/java/io/quarkus/ts/docker/HelloResource.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package io.quarkus.ts.docker; | ||
|
||
import jakarta.ws.rs.GET; | ||
import jakarta.ws.rs.Path; | ||
import jakarta.ws.rs.Produces; | ||
import jakarta.ws.rs.core.MediaType; | ||
import jakarta.ws.rs.core.Response; | ||
|
||
@Path("/hello") | ||
public class HelloResource { | ||
@GET | ||
@Produces(MediaType.TEXT_PLAIN) | ||
public Response get() { | ||
return Response.ok("hello World").build(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
quarkus.container-image.group=qe | ||
# DON'T remove the spaces that are at the end of quarkus app name | ||
quarkus.application.name=hello-world-podman-app | ||
quarkus.container-image.tag=1.0.0 |
40 changes: 40 additions & 0 deletions
40
build/podman/src/test/java/io/quarkus/ts/docker/PodmanBuildIT.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
package io.quarkus.ts.docker; | ||
|
||
import static org.junit.jupiter.api.Assertions.assertTrue; | ||
|
||
import java.util.Objects; | ||
|
||
import org.junit.jupiter.api.AfterAll; | ||
import org.junit.jupiter.api.Test; | ||
import org.junit.jupiter.api.condition.EnabledIfEnvironmentVariable; | ||
|
||
import com.github.dockerjava.api.model.Image; | ||
|
||
import io.quarkus.test.scenarios.QuarkusScenario; | ||
import io.quarkus.test.utils.DockerUtils; | ||
|
||
@QuarkusScenario | ||
@EnabledIfEnvironmentVariable(named = "DOCKER_HOST", matches = ".*podman.*") | ||
/** | ||
* We run the tests only when podman is enabled and does not pretend to be Docker | ||
* since otherwise we won't be able to distinguish between the extension being broken | ||
* and a situation, when podman is not installed. | ||
* | ||
* Unfortunately, that means, that the test is disabled on Windows and Mac | ||
*/ | ||
public class PodmanBuildIT { | ||
// Local container build, no need in tracking image in properties | ||
private static final String IMAGE_NAME = "hello-world-podman-app"; | ||
private static final String IMAGE_VERSION = "1.0.0"; | ||
|
||
@AfterAll | ||
public static void tearDown() { | ||
DockerUtils.removeImage(IMAGE_NAME, IMAGE_VERSION); | ||
} | ||
|
||
@Test | ||
public void verifyImageNameWithSpaces() { | ||
Image image = DockerUtils.getImage(IMAGE_NAME, IMAGE_VERSION); | ||
assertTrue(Objects.nonNull(image.getId()) && !image.getId().isEmpty(), "The image was not created"); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters