-
Notifications
You must be signed in to change notification settings - Fork 3k
Native S2I Builder image #1358
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Native S2I Builder image #1358
Changes from 7 commits
86a6c94
d971989
0f677d6
43cd78b
335cdfb
9fb4604
0f5d431
2f3e547
326b8b8
33e95b8
cb25510
387df05
c6f093c
c165b1c
7c14305
4b550da
04029d9
a05b6f3
fafe896
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
# [Quarkus.io](http://quarkus.io) *native* S2I builder | ||
# Original Author: Michael Vorburger.ch | ||
|
||
# This part is heavily inspired by ../centos-graal/Dockerfile | ||
FROM centos:latest | ||
|
||
ARG GRAAL_VERSION | ||
ENV GRAAL_VERSION=${GRAAL_VERSION:-1.0.0-rc12} | ||
vorburger marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
ARG MAVEN_VERSION=3.6.0 | ||
cescoffier marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
ENV GRAAL_CE_URL=https://github.com/oracle/graal/releases/download/vm-${GRAAL_VERSION}/graalvm-ce-${GRAAL_VERSION}-linux-amd64.tar.gz | ||
ENV MAVEN_URL=https://archive.apache.org/dist/maven/maven-3/$MAVEN_VERSION/binaries/apache-maven-$MAVEN_VERSION-bin.tar.gz | ||
|
||
ENV JAVA_HOME=/opt/graalvm | ||
ENV PATH=$PATH:$JAVA_HOME/bin | ||
ENV GRAALVM_HOME=/opt/graalvm | ||
|
||
RUN yum update -y && \ | ||
yum install -y --setopt=skip_missing_names_on_install=False \ | ||
tar gzip gcc glibc-devel zlib-devel curl && \ | ||
mkdir -p /opt/graalvm && \ | ||
cd /opt/graalvm && \ | ||
curl -fsSL $GRAAL_CE_URL | tar -xzC /opt/graalvm --strip-components=1 && \ | ||
|
||
# This part is inspired by ../centos-graal-maven/Dockerfile and fabric8io-images/s2i | ||
|
||
mkdir -p /usr/share/maven && \ | ||
curl -fsSL ${MAVEN_URL} | tar -xzC /usr/share/maven --strip-components=1 && \ | ||
ln -s /usr/share/maven/bin/mvn /usr/bin/mvn | ||
|
||
ENV MAVEN_HOME /usr/share/maven | ||
ENV MAVEN_CONFIG "$USER_HOME_DIR/.m2" | ||
ENV MAVEN_OPTS="-XX:+TieredCompilation -XX:TieredStopAtLevel=1" | ||
|
||
# This part is firmly inspired by fabric8io-images/s2i | ||
|
||
LABEL io.openshift.s2i.scripts-url="image:///usr/local/s2i" \ | ||
io.openshift.s2i.destination="/tmp" \ | ||
|
||
io.k8s.description="Quarkus.io S2I image for building Kubernetes Native Java GraalVM applications and running its Native Executables" \ | ||
io.k8s.display-name="Quarkus.io S2I (GraalVM Native)" \ | ||
io.openshift.tags="builder,java,quarkus,native" | ||
|
||
# S2I scripts + README | ||
COPY s2i /usr/local/s2i | ||
RUN chmod 755 /usr/local/s2i/* | ||
ADD README.md /usr/local/s2i/usage.txt | ||
|
||
ENV PATH=$PATH:"/usr/local/s2i" | ||
|
||
RUN mkdir /quarkus.io/ | ||
|
||
|
||
EXPOSE 8080 | ||
cescoffier marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
# Use the run script as default since we are working as an hybrid image which can be | ||
# used directly to. (If we were a plain s2i image we would print the usage info here.) | ||
CMD [ "/usr/local/s2i/run" ] |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# [Quarkus.io](http://quarkus.io) GraalVM Native S2I | ||
|
||
## OpenShift | ||
|
||
### OpenShift Build | ||
|
||
oc new-build https://github.com/quarkusio/quarkus.git --context-dir=docker/centos-graal-maven-s2i --name quarkus-native-s2i | ||
cescoffier marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
### OpenShift Use | ||
|
||
oc new-app quarkus-native-s2i~https://github.com/quarkusio/quarkus-quickstarts --context-dir=getting-started-native --name=getting-started-native | ||
cescoffier marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
||
Note that GraalVM-based native build are more memory & CPU intensive than regular pure Java builds, | ||
and you therefore may need to increase the quota for OpenShift's S2I builder containers. | ||
|
||
|
||
## Locally (only for testing) | ||
|
||
### Local Build | ||
|
||
docker build . -t quarkus-native-s2i | ||
|
||
### Local use | ||
|
||
sudo dnf install source-to-image | ||
|
||
s2i build --copy ../../../quarkus-quickstarts/getting-started-native quarkus-native-s2i getting-started-native | ||
|
||
docker run --rm -it -p 8080:8080 getting-started-native | ||
|
||
curl http://localhost:8080/hello/greeting/quarkus |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
#!/bin/sh | ||
|
||
# This POC script is based on the openshift/source-to-image project documentation, | ||
# and loosely inspired by fabric8io-images/s2i's assemble script, but **MUCH** simplified; | ||
# a TODO future PRODUCTION version of this would probably want to re-use that script... | ||
|
||
set -ex | ||
|
||
cd /tmp/src/ | ||
mvn package -Pnative -e -B \ | ||
-DskipTests -Dmaven.javadoc.skip=true -Dmaven.site.skip=true -Dmaven.source.skip=true \ | ||
-Djacoco.skip=true -Dcheckstyle.skip=true -Dfindbugs.skip=true -Dpmd.skip=true -Dfabric8.skip=true | ||
cp target/*-runner /quarkus.io/ | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#!/bin/sh | ||
|
||
# This POC script is (intentionally) overly trivial. | ||
# a TODO future PRODUCTION version of this would probably want tomake it possible to | ||
# e.g. pass additional parameters to the executable, as does fabric8io-images/s2i's run script. | ||
|
||
/quarkus.io/*-runner -Dquarkus.http.host=0.0.0.0 | ||
cescoffier marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
Uh oh!
There was an error while loading. Please reload this page.