Commit c65d5a03 authored by cnguyen2's avatar cnguyen2
Browse files

Add quarkus-container-image-docker and update dependency

parent cde8ece5
......@@ -8,11 +8,11 @@ variables:
build native:
stage: build
- master
- mvn -f $CI_PROJECT_DIR/pom.xml clean package -P native
- mvn -f $CI_PROJECT_DIR/pom.xml clean package -Pnative
- $CI_PROJECT_DIR/target/*-runner
# Gene Info Service for the iBeetleBase project
This microservice is based on Quarkus (version 1.4.2).
It can be used for querying gene information in JSON format.
Currently, it holds gene information for Tribolium castaneum and Drosophila melanogaster.
# Gene Info Service for the iBeetle-Base project
## Running the application in dev mode
The easiest way to use the application is by starting it in dev mode:
./mvnw quarkus:dev
## Querying the Service
Once the service is running, gene information can be queried using cURL like this:
curl -X GET "http://localhost:8080/geneinfo/current/v1/DATABASE/ID"
where DATABASE is either `tribolium` or `flybase` and ID is the gene identifier.
Gene identifiers can be in TC format (e.g. `TC016101`) or in FBgn format (e.g. `FBgn0010400`).
Replacing ID with `identifiers` returns a list of all gene IDs for the specific database.
## Packaging and containerizing
The application can be packaged and containerized by one command (docker required)
Multiple genes can be queried with comma-separated requests:
curl -X GET "http://localhost:8080/geneinfo/current/v1/id?=TC016101,TC016102,FBgn10400"
./mvnw package
## Packaging and running the application
The application can be packaged using `./mvnw package`.
It produces the `geneinfoservice_new-1.0-SNAPSHOT-runner.jar` file in the `/target` directory.
Be aware that it’s not an _über-jar_ as the dependencies are copied into the `target/lib` directory.
The application is now runnable using `java -jar target/geneinfoservice_new-1.0-SNAPSHOT-runner.jar`.
## Creating a native executable
You can create a native executable using: `./mvnw package -Pnative`.
Or, if you don't have GraalVM installed, you can run the native executable build in a container using: `./mvnw package -Pnative -Dquarkus.native.container-build=true`.
You can then execute your native executable with: `./target/geneinfoservice_new-1.0-SNAPSHOT-runner`
If you want to learn more about building native executables, please consult
......@@ -12,10 +12,10 @@
......@@ -52,6 +52,10 @@
# This Dockerfile is used in order to build a container that runs the Quarkus application in JVM mode
# Before building the docker image run:
# mvn package
# Then, build the image with:
# docker build -f src/main/docker/Dockerfile.jvm -t ibb/api/geneinfoservice-jvm .
# Then run the container using:
# docker run -i --rm -p 8080:8080 ibb/api/geneinfoservice-jvm
ARG JAVA_PACKAGE=java-11-openjdk-headless
# Install java and the run-java script
# Also set up permissions for user `1001`
RUN microdnf install curl ca-certificates ${JAVA_PACKAGE} \
......@@ -33,14 +15,15 @@ RUN microdnf install curl ca-certificates ${JAVA_PACKAGE} \
&& curl${RUN_JAVA_VERSION}/run-java-sh-${RUN_JAVA_VERSION} -o /deployments/ \
&& chown 1001 /deployments/ \
&& chmod 540 /deployments/ \
&& echo "securerandom.source=file:/dev/urandom" >> /etc/alternatives/jre/lib/security/
&& echo "securerandom.source=file:/dev/urandom" >> /etc/alternatives/jre/conf/security/
# Configure the JAVA_OPTIONS, you can add -XshowSettings:vm to also display the heap size.
ENV JAVA_OPTIONS=" -Djava.util.logging.manager=org.jboss.logmanager.LogManager"
COPY target/lib/* /deployments/lib/
COPY target/*-runner.jar /deployments/app.jar
COPY data/* /deployments/data/
# We make four distinct layers so if there are application changes the library layers can be re-used
COPY --chown=1001 target/quarkus-app/lib/ /deployments/lib/
COPY --chown=1001 target/quarkus-app/*.jar /deployments/
COPY --chown=1001 target/quarkus-app/app/ /deployments/app/
COPY --chown=1001 target/quarkus-app/quarkus/ /deployments/quarkus/
USER 1001
## Stage 1 : build with maven builder image with native capabilities
FROM 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 -Pnative clean package
## Stage 2 : create the docker final image
WORKDIR /work/
COPY --from=build /usr/src/app/target/*-runner /work/application
# set up permissions for user `1001`
RUN chmod 775 /work /work/application \
&& chown -R 1001 /work \
&& chmod -R "g+rwX" /work \
&& chown -R 1001:root /work
COPY data/* /work/data/
USER 1001
CMD ["./application", ""]
# This Dockerfile is used in order to build a container that runs the Quarkus application in native (no JVM) mode
# Before building the docker image run:
# mvn package -Pnative -Dquarkus.native.container-build=true
# Then, build the image with:
# docker build -f src/main/docker/Dockerfile.native -t ibb/api/geneinfoservice .
# Then run the container using:
# docker run -i --rm -p 8080:8080 ibb/api/geneinfoservice
WORKDIR /work/
COPY target/*-runner /work/application
#COPY data/* /work/data/
# set up permissions for user `1001`
RUN chmod 775 /work /work/application \
&& chown -R 1001 /work \
&& chmod -R "g+rwX" /work \
......@@ -2,151 +2,11 @@
<html lang="en">
<meta charset="UTF-8">
<title>GeneinfoService - 1.0-SNAPSHOT</title>
h1, h2, h3, h4, h5, h6 {
margin-bottom: 0.5rem;
font-weight: 400;
line-height: 1.5;
h1 {
font-size: 2.5rem;
h2 {
font-size: 2rem
h3 {
font-size: 1.75rem
h4 {
font-size: 1.5rem
h5 {
font-size: 1.25rem
h6 {
font-size: 1rem
.lead {
font-weight: 300;
font-size: 2rem;
.banner {
font-size: 2.7rem;
margin: 0;
padding: 2rem 1rem;
background-color: #00A1E2;
color: white;
body {
margin: 0;
font-family: -apple-system, system-ui, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
code {
font-family: SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
font-size: 87.5%;
color: #e83e8c;
word-break: break-word;
.left-column {
padding: .75rem;
max-width: 75%;
min-width: 55%;
.right-column {
padding: .75rem;
max-width: 25%;
.container {
display: flex;
width: 100%;
li {
margin: 0.75rem;
.right-section {
margin-left: 1rem;
padding-left: 0.5rem;
.right-section h3 {
padding-top: 0;
font-weight: 200;
.right-section ul {
border-left: 0.3rem solid #00A1E2;
list-style-type: none;
padding-left: 0;
<title>Geneinfo Service</title>
<div class="banner lead">
Your new Cloud-Native application is ready!
<div class="container">
<div class="left-column">
<p class="lead"> Congratulations, you have created a new Quarkus application.</p>
<h2>Why do you see this?</h2>
<p>This page is served by Quarkus. The source is in
<h2>What can I do from here?</h2>
<p>If not already done, run the application in <em>dev mode</em> using: <code>mvn compile quarkus:dev</code>.
<li>Add REST resources, Servlets, functions and other services in <code>src/main/java</code>.</li>
<li>Your static assets are located in <code>src/main/resources/META-INF/resources</code>.</li>
<li>Configure your application in <code>src/main/resources/</code>.
<h2>How do I get rid of this page?</h2>
<p>Just delete the <code>src/main/resources/META-INF/resources/index.html</code> file.</p>
<div class="right-column">
<div class="right-section">
<li>ArtifactId: GeneinfoService</li>
<li>Version: 1.0-SNAPSHOT</li>
<li>Quarkus Version: 1.3.2.Final</li>
<div class="right-section">
<h3>Next steps</h3>
<li><a href="" target="_blank">Setup your IDE</a></li>
<li><a href="" target="_blank">Getting started</a></li>
<li><a href="" target="_blank">Quarkus Web Site</a></li>
<a href="q/swagger-ui">Swagger UI</a>
\ No newline at end of file
......@@ -5,13 +5,20 @@ quarkus.http.cors=true
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment