Update base image of Dockerfile (#17007)

* Update base image of Dockerfile

* Make github workflow "Docker tests" manually triggerable

* Don't possibly downgrade TLS version

* Update Dockerimage in ``run-in-docker.sh``

* Use Maven's non interactive mode inside workflow

* Don't spam log

* Use java 17

because it won't compile with 21

* Removed hard memory limit

as memory should be controlled by the container

* Update hub dockerfiles
This commit is contained in:
litetex 2023-11-14 04:41:49 +01:00 committed by GitHub
parent d1b148a7d3
commit 2c25443260
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 13 additions and 12 deletions

View File

@ -1,6 +1,7 @@
name: Docker tests
on:
workflow_dispatch:
push:
paths:
- Dockerfile
@ -27,7 +28,7 @@ jobs:
shell: bash
run: |
sed -i 's/ -it / /g' run-in-docker.sh
./run-in-docker.sh mvn clean install
./run-in-docker.sh mvn -B clean install
- name: Build Dockerfile
shell: bash

View File

@ -3,19 +3,19 @@
##
## You can build _just_ this part with:
## docker --target builder -t container-name:builder -f .hub.cli.dockerfile .
FROM maven:3.6.3-jdk-11-openj9 as builder
FROM maven:3-eclipse-temurin-17 as builder
ENV GEN_DIR /opt/openapi-generator
WORKDIR ${GEN_DIR}
COPY . ${GEN_DIR}
# Pre-compile openapi-generator-cli
RUN mvn -am -pl "modules/openapi-generator-cli" package
RUN mvn -B -am -pl "modules/openapi-generator-cli" package
## The final (release) image
## The resulting container here only needs the target jar
## and ca-certificates (to be able to query HTTPS hosted specs)
FROM openjdk:11.0.8-jre-slim-buster
FROM eclipse-temurin:17-jre
ENV GEN_DIR /opt/openapi-generator

View File

@ -3,18 +3,18 @@
##
## You can build _just_ this part with:
## docker --target builder -t container-name:builder -f .hub.online.dockerfile .
FROM maven:3.6.3-jdk-11-openj9 as builder
FROM maven:3-eclipse-temurin-17 as builder
ENV GEN_DIR /opt/openapi-generator
WORKDIR ${GEN_DIR}
COPY . ${GEN_DIR}
# Pre-compile openapi-generator-online
RUN mvn -am -pl "modules/openapi-generator-online" package
RUN mvn -B -am -pl "modules/openapi-generator-online" package
## The final (release) image
## The resulting container here only needs the target jar
FROM openjdk:11.0.8-jre-slim-buster
FROM eclipse-temurin:17-jre
ENV GEN_DIR /opt/openapi-generator
ENV TARGET_DIR /generator

View File

@ -1,4 +1,4 @@
FROM maven:3.6.3-jdk-11-openj9
FROM maven:3-eclipse-temurin-17
ENV GEN_DIR /opt/openapi-generator
WORKDIR ${GEN_DIR}
@ -20,7 +20,7 @@ COPY ./modules/openapi-generator ${GEN_DIR}/modules/openapi-generator
COPY ./pom.xml ${GEN_DIR}
# Pre-compile openapi-generator-cli
RUN mvn -am -pl "modules/openapi-generator-cli" package
RUN mvn -B -am -pl "modules/openapi-generator-cli" package
# This exists at the end of the file to benefit from cached layers when modifying docker-entrypoint.sh.
COPY docker-entrypoint.sh /usr/local/bin/

View File

@ -4,7 +4,7 @@ set -euo pipefail
# GEN_DIR allows to share the entrypoint between Dockerfile and run-in-docker.sh (backward compatible)
GEN_DIR=${GEN_DIR:-/opt/openapi-generator}
JAVA_OPTS=${JAVA_OPTS:-"-Xmx1024M -DloggerPath=conf/log4j.properties"}
JAVA_OPTS=${JAVA_OPTS:-"-DloggerPath=conf/log4j.properties"}
cli="${GEN_DIR}/modules/openapi-generator-cli"
codegen="${cli}/target/openapi-generator-cli.jar"

View File

@ -15,10 +15,10 @@ docker run --rm -it \
-w /gen \
-e GEN_DIR=/gen \
-e MAVEN_CONFIG=/var/maven/.m2 \
-e MAVEN_OPTS="-Dhttps.protocols=TLSv1.2 -Dmaven.repo.local=/var/maven/.m2/repository -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=WARN -Dorg.slf4j.simpleLogger.showDateTime=true -Djava.awt.headless=true -Djacoco.skip=true" \
-e MAVEN_OPTS="-Dmaven.repo.local=/var/maven/.m2/repository -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=WARN -Dorg.slf4j.simpleLogger.showDateTime=true -Djava.awt.headless=true -Djacoco.skip=true" \
-u "$(id -u):$(id -g)" \
-v "${PWD}:/gen" \
-v "${PWD}/CI/run-in-docker-settings.xml:/var/maven/.m2/settings.xml" \
-v "${maven_cache_repo}:/var/maven/.m2/repository" \
--entrypoint /gen/docker-entrypoint.sh \
maven:3-jdk-11 "$@"
maven:3-eclipse-temurin-17 "$@"