-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add pipeline run script and jvm multistage build
- Loading branch information
rhertle
committed
Sep 4, 2020
1 parent
f1300cb
commit 7e2de41
Showing
2 changed files
with
43 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
tkn pipeline start apply-and-build -r git-repo=data-producer-repo -r image=data-producer-image -p deployment-name=data-producer -p docker-file=src/main/docker/Dockerfile.multistage.jvm -s pipeline |
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,42 @@ | ||
## Stage 1 : build with maven builder image with native capabilities | ||
FROM quay.io/quarkus/centos-quarkus-maven:20.1.0-java11 AS build | ||
COPY pom.xml /usr/src/app/ | ||
RUN mvn -f /usr/src/app/pom.xml -B de.qaware.maven:go-offline-maven-plugin:1.2.5:resolve-dependencies | ||
COPY src /usr/src/app/src | ||
USER root | ||
RUN chown -R quarkus /usr/src/app | ||
USER quarkus | ||
RUN mvn -f /usr/src/app/pom.xml clean package | ||
|
||
## Stage 2 : create the docker final image | ||
FROM registry.access.redhat.com/ubi8/ubi-minimal:8.1 | ||
|
||
ARG JAVA_PACKAGE=java-11-openjdk-headless | ||
ARG RUN_JAVA_VERSION=1.3.8 | ||
|
||
ENV LANG='en_US.UTF-8' LANGUAGE='en_US:en' | ||
|
||
# Install java and the run-java script | ||
# Also set up permissions for user `1001` | ||
RUN microdnf install curl ca-certificates ${JAVA_PACKAGE} \ | ||
&& microdnf update \ | ||
&& microdnf clean all \ | ||
&& mkdir /deployments \ | ||
&& chown 1001 /deployments \ | ||
&& chmod "g+rwX" /deployments \ | ||
&& chown 1001:root /deployments \ | ||
&& curl https://repo1.maven.org/maven2/io/fabric8/run-java-sh/${RUN_JAVA_VERSION}/run-java-sh-${RUN_JAVA_VERSION}-sh.sh -o /deployments/run-java.sh \ | ||
&& chown 1001 /deployments/run-java.sh \ | ||
&& chmod 540 /deployments/run-java.sh \ | ||
&& echo "securerandom.source=file:/dev/urandom" >> /etc/alternatives/jre/lib/security/java.security | ||
|
||
# Configure the JAVA_OPTIONS, you can add -XshowSettings:vm to also display the heap size. | ||
ENV JAVA_OPTIONS="-Dquarkus.http.host=0.0.0.0 -Djava.util.logging.manager=org.jboss.logmanager.LogManager" | ||
|
||
COPY --from=build /usr/src/app/target/lib/* /deployments/lib/ | ||
COPY --from=build /usr/src/app/target/*-runner.jar /deployments/app.jar | ||
|
||
EXPOSE 8080 | ||
USER 1001 | ||
|
||
ENTRYPOINT [ "/deployments/run-java.sh" ] |