Skip to content

Commit

Permalink
switch generator-v3 docker image to ubi-minimal jre-17
Browse files Browse the repository at this point in the history
  • Loading branch information
frantuma committed Jan 27, 2023
1 parent 344b287 commit d626d38
Show file tree
Hide file tree
Showing 9 changed files with 27 additions and 10 deletions.
13 changes: 9 additions & 4 deletions modules/swagger-generator/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
FROM ubuntu:22.04
FROM redhat/ubi9-minimal:9.1
RUN microdnf -y install shadow-utils
RUN microdnf -y install which
RUN microdnf -y install glibc-langpack-en
ENV disableOas31Resolve=False
ENV JAVA_HOME=/opt/java/openjdk
COPY --from=eclipse-temurin:8u322-b06-jre $JAVA_HOME $JAVA_HOME
COPY --from=eclipse-temurin:17-jre $JAVA_HOME $JAVA_HOME
ENV PATH="${JAVA_HOME}/bin:${PATH}"
COPY docker/environment /etc/environment

WORKDIR /jetty_home
COPY docker/jetty /jetty_home/
Expand All @@ -24,10 +28,11 @@ ARG HTTP_PORT
ENV HTTP_PORT ${HTTP_PORT}
ARG JAVA_MEM
ENV JAVA_MEM ${JAVA_MEM}
ENV EXIT_ON_OUTOFMEMORYERROR ""
WORKDIR $JETTY_BASE

RUN addgroup --gid 2000 codegengroup
RUN adduser --home "/generator" --ingroup codegengroup --disabled-password --gecos '' --shell "/bin/bash" --uid "1000" codegenuser
RUN groupadd --gid 2000 codegengroup
RUN useradd --home "/generator" --gid codegengroup --shell "/bin/bash" --uid "1000" codegenuser
RUN chown -R codegenuser /generator
RUN chown -R codegenuser /jetty_home

Expand Down
9 changes: 7 additions & 2 deletions modules/swagger-generator/Dockerfile_root
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
FROM ubuntu:22.04
FROM redhat/ubi9-minimal:9.1
RUN microdnf -y install which
RUN microdnf -y install glibc-langpack-en
ENV disableOas31Resolve=False
ENV JAVA_HOME=/opt/java/openjdk
COPY --from=eclipse-temurin:8u322-b06-jre $JAVA_HOME $JAVA_HOME
COPY --from=eclipse-temurin:17-jre $JAVA_HOME $JAVA_HOME
ENV PATH="${JAVA_HOME}/bin:${PATH}"
COPY docker/environment /etc/environment

WORKDIR /jetty_home
COPY docker/jetty /jetty_home/
Expand All @@ -11,6 +14,7 @@ RUN rm /jetty_home/lib/jetty-runner*
COPY target/lib/javax.servlet-api* /jetty_home/lib/servlet-api-3.1.jar
COPY target/lib/start.jar /jetty_home/
ENV JETTY_HOME /jetty_home

WORKDIR /generator
COPY docker/jetty_base /generator/
COPY docker/ROOT.xml /generator/webapps/ROOT.xml
Expand All @@ -23,5 +27,6 @@ ARG HTTP_PORT
ENV HTTP_PORT ${HTTP_PORT}
ARG JAVA_MEM
ENV JAVA_MEM ${JAVA_MEM}
ENV EXIT_ON_OUTOFMEMORYERROR ""
WORKDIR $JETTY_BASE
CMD ["./start"]
2 changes: 1 addition & 1 deletion modules/swagger-generator/docker/ROOT.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<Configure class="org.eclipse.jetty.webapp.WebAppContext">
<Set name="contextPath">/</Set>
<Set name="war"><Property name="jetty.webapps" default="."/>/ROOT.war</Set>
<New id="jarFilter" class="sun.misc.JarFilter">
<New id="jarFilter" class="io.swagger.v3.generator.filter.JarFilter">
</New>
<New id="classpathDirFile" class="java.io.File">
<Arg>/jetty_home/lib/shared</Arg>
Expand Down
2 changes: 2 additions & 0 deletions modules/swagger-generator/docker/environment
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
LANG=en_US.utf-8
LC_ALL=en_US.utf-8
Binary file not shown.
1 change: 1 addition & 0 deletions modules/swagger-generator/docker/jetty/modules/deploy.mod
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ Enables webapplication deployment from the webapps directory.
webapp

[lib]
lib/classpathfilter.jar
lib/jetty-deploy-${jetty.version}.jar

[files]
Expand Down
6 changes: 5 additions & 1 deletion modules/swagger-generator/docker/jetty_base/start
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@ export LC_ALL=en_US.utf-8
NEW_SIZE=${JAVA_NEW-128m}
PERM_SIZE=${JAVA_PERM-128m}
HEAP=${JAVA_MEM-512m}
EXIT_ON_OUTOFMEMORYERROR_OPTION=
if [ ! -z "$EXIT_ON_OUTOFMEMORYERROR" ]; then
EXIT_ON_OUTOFMEMORYERROR_OPTION=-XX:+ExitOnOutOfMemoryError
fi

mkdir -p work

Expand All @@ -43,7 +47,7 @@ JAVA_DEBUG_OPTIONS="-Xdebug -Xrunjdwp:transport=dt_socket,address=8005,server=y,
# APP options
APP_OPTS="-DHIDDEN_OPTIONS_PATH=${HIDDEN_OPTIONS_PATH} -DHIDDEN_OPTIONS=${HIDDEN_OPTIONS}"
# JVM options
JAVA_OPTS="-Djava.security.manager -Djava.security.policy==grantall.policy -DgeneratorWriteDirs="/tmp" -server -Duser.timezone=GMT -Xms${HEAP} -Xmx${HEAP} -XX:NewSize=${NEW_SIZE} -XX:MaxNewSize=${NEW_SIZE} -XX:+UseConcMarkSweepGC -XX:+UseParNewGC -XX:PermSize=${PERM_SIZE} -XX:MaxPermSize=${PERM_SIZE} -Dfile.encoding=UTF-8"
JAVA_OPTS="-Djava.security.manager -Djava.security.policy==grantall.policy -DgeneratorWriteDirs="/tmp" -server -Duser.timezone=GMT -Xms${HEAP} -Xmx${HEAP} -XX:NewSize=${NEW_SIZE} -XX:MaxNewSize=${NEW_SIZE} ${EXIT_ON_OUTOFMEMORYERROR_OPTION} -Dfile.encoding=UTF-8"

echo "Starting application with command: "
echo ${JAVA_EXEC} ${JETTY_OPTS} ${APP_OPTS} ${JAVA_OPTS} -jar $JETTY_HOME/start.jar
Expand Down
2 changes: 1 addition & 1 deletion pom.docker.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1138,7 +1138,7 @@
<reflections-version>0.9.11</reflections-version>
<jmockit-version>1.42</jmockit-version>
<snakeyaml-version>1.33</snakeyaml-version>
<handlebars-version>4.3.0</handlebars-version>
<handlebars-version>4.3.1</handlebars-version>
<jersey-version>2.35</jersey-version>
</properties>
</project>
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1242,7 +1242,7 @@
<reflections-version>0.9.11</reflections-version>
<jmockit-version>1.42</jmockit-version>
<snakeyaml-version>1.33</snakeyaml-version>
<handlebars-version>4.3.0</handlebars-version>
<handlebars-version>4.3.1</handlebars-version>
<jersey-version>2.35</jersey-version>
</properties>
</project>

0 comments on commit d626d38

Please sign in to comment.