refactor: rework tomcat-manager, wildfly-manager & vertx-gateway to use ARGs for versions
To enable easier overriding of version numbers at build-time, we use ARGs.
Use `--build-arg` with `docker build`. For example `--build-arg APIMAN_VERSION=4.0.0-SNAPSHOT`.
MODIFY
.gitignore
.gitignore
@@ -6,3 +6,4 @@ pom.xml.next
release.properties
.settings
.project
+.idea

MODIFY
tomcat-manager/Dockerfile
tomcat-manager/Dockerfile
-FROM tomcat:9.0.64-jdk11-temurin
-
-MAINTAINER florian.volk@scheer-group.com
-EXPOSE 8080 8443
+ARG BASE_IMAGE=tomcat:9.0.64-jdk11-temurin
+FROM $BASE_IMAGE
ARG APIMAN_VERSION
+ARG APIMAN_DISTRO=https://github.com/apiman/apiman/releases/download/$APIMAN_VERSION/apiman-distro-tomcat-$APIMAN_VERSION-overlay.zip
+ARG POSTGRES_VERSION=42.3.0
+
+LABEL org.opencontainers.image.authors="florian.volk@scheer-group.com"
+LABEL org.opencontainers.image.licenses="Apache-2.0"
+LABEL org.opencontainers.image.url="https://www.apiman.io"
+LABEL org.opencontainers.image.source="https://www.github.com/apiman/apiman"
+LABEL org.opencontainers.image.title="Apiman Manager (Tomcat distro)"
+LABEL org.opencontainers.image.description="Apiman Manager API and UI (Tomcat distro)"
+LABEL org.opencontainers.image.version=$APIMAN_VERSION
+
+EXPOSE 8080 8443
USER root
-ADD https://github.com/Apiman/apiman/releases/download/$APIMAN_VERSION/apiman-distro-tomcat-$APIMAN_VERSION-overlay.zip $CATALINA_HOME
+
+ADD $APIMAN_DISTRO /tmp/apiman-overlay.zip
+ADD https://jdbc.postgresql.org/download/postgresql-$POSTGRES_VERSION.jar $CATALINA_HOME/lib
+
RUN groupadd -r tomcat && \
useradd --no-log-init --create-home -r -g tomcat tomcat && \
chown -R tomcat:tomcat /home/tomcat && \
@@ -15,11 +28,10 @@ RUN groupadd -r tomcat && \
apt-get clean
WORKDIR $CATALINA_HOME
-RUN unzip -o apiman-distro-tomcat-$APIMAN_VERSION-overlay.zip && \
- # speed up tomcat
+RUN unzip -o /tmp/apiman-overlay.zip && \
+ rm /tmp/apiman-overlay.zip && \
unzip -o webapps/apimanui.war -d webapps/apimanui && \
unzip -o webapps/apiman.war -d webapps/apiman && \
- rm apiman-distro-tomcat-$APIMAN_VERSION-overlay.zip && \
rm webapps/apiman-gateway.war && rm webapps/apiman-gateway-api.war && \
chgrp -R tomcat $CATALINA_HOME && chmod -R g+rw $CATALINA_HOME

MODIFY
vertx-gateway/Dockerfile
vertx-gateway/Dockerfile
-FROM eclipse-temurin:11.0.13_8-jre-alpine
-
-MAINTAINER florian.volk@scheer-group.com
-EXPOSE 8080 8081
+ARG BASE_IMAGE=eclipse-temurin:11-jre-alpine
+FROM $BASE_IMAGE
ARG APIMAN_VERSION
+ARG APIMAN_DISTRO=https://github.com/apiman/apiman/releases/download/$APIMAN_VERSION/apiman-distro-vertx-$APIMAN_VERSION.zip
+
+LABEL org.opencontainers.image.authors="florian.volk@scheer-group.com"
+LABEL org.opencontainers.image.licenses="Apache-2.0"
+LABEL org.opencontainers.image.url="https://www.apiman.io"
+LABEL org.opencontainers.image.source="https://www.github.com/apiman/apiman"
+LABEL org.opencontainers.image.title="Apiman Gateway (Vert.x distro)"
+LABEL org.opencontainers.image.description="Apiman Gateway (Vert.x distro). Unless you are operating headlessly, you need an Apiman Manager as well."
+LABEL org.opencontainers.image.version=$APIMAN_VERSION
+
+EXPOSE 8080 8081
RUN addgroup -S apiman && adduser -S apiman -G apiman && \
mkdir -p /opt/apiman/logs && \
chown -R apiman:apiman /home/apiman /opt/apiman/logs && \
- apk update && apk add curl unzip && rm -rf /var/cache/apk/*
+ apk update && apk add libarchive-tools && rm -rf /var/cache/apk/*
+
+ADD $APIMAN_DISTRO /tmp/apiman-distro-vertx.zip
-RUN curl -s -L https://github.com/Apiman/apiman/releases/download/$APIMAN_VERSION/apiman-distro-vertx-$APIMAN_VERSION.zip -o /tmp/apiman-distro-vertx-${APIMAN_VERSION}.zip && \
- unzip /tmp/apiman-distro-vertx-${APIMAN_VERSION}.zip -d /tmp && \
- mv /tmp/apiman-distro-vertx-${APIMAN_VERSION}/* /opt/apiman/ && rm -rf /tmp/* && \
+RUN bsdtar xvf /tmp/apiman-distro-vertx.zip --strip-components=1 -C /opt/apiman && \
+ rm /tmp/apiman-distro-vertx.zip && \
chmod +x /opt/apiman/apiman-gateway.sh
USER apiman

MODIFY
wildfly-manager/Dockerfile
wildfly-manager/Dockerfile
-FROM jboss/wildfly:20.0.1.Final
+ARG WILDFLY_VERSION=23.0.2.Final
+FROM jboss/wildfly:${WILDFLY_VERSION}
+
+ARG APIMAN_VERSION
+ARG APIMAN_DISTRO=https://github.com/Apiman/apiman/releases/download/$APIMAN_VERSION/apiman-distro-wildfly-$APIMAN_VERSION-overlay.zip
+ARG POSTGRES_VERSION=42.3.0
+
+LABEL org.opencontainers.image.authors="florian.volk@scheer-group.com,marc@blackparrotlabs.io"
+LABEL org.opencontainers.image.licenses="Apache-2.0"
+LABEL org.opencontainers.image.url="https://www.apiman.io"
+LABEL org.opencontainers.image.source="https://www.github.com/apiman/apiman"
+LABEL org.opencontainers.image.title="Apiman Manager (WildFly distro)"
+LABEL org.opencontainers.image.description="Apiman Manager API and UI (WildFly distro)"
+LABEL org.opencontainers.image.version=$APIMAN_VERSION
-MAINTAINER florian.volk@scheer-group.com
EXPOSE 8080 8443
-ARG APIMAN_VERSION
+ADD https://jdbc.postgresql.org/download/postgresql-$POSTGRES_VERSION.jar $JBOSS_HOME/standalone/deployments
+ADD $APIMAN_DISTRO /tmp/apiman-overlay.zip
USER root
WORKDIR $JBOSS_HOME
-RUN curl -L https://github.com/Apiman/apiman/releases/download/$APIMAN_VERSION/apiman-distro-wildfly-$APIMAN_VERSION-overlay.zip | bsdtar -xvf- && \
- rm -rf $JBOSS_HOME/standalone/deployments/apiman-ds.xml && \
- rm -rf $JBOSS_HOME/standalone/deployments/apiman-gateway-ds.xml && \
- rm -rf $JBOSS_HOME/standalone/deployments/apiman-gateway.war && \
- rm -rf $JBOSS_HOME/standalone/deployments/apiman-gateway-api.war && \
+RUN unzip -o /tmp/apiman-overlay.zip && \
+ rm $JBOSS_HOME/standalone/deployments/apiman-gateway-ds.xml && \
+ rm $JBOSS_HOME/standalone/deployments/apiman-gateway.war && \
+ rm $JBOSS_HOME/standalone/deployments/apiman-gateway-api.war && \
chown -R jboss:jboss $JBOSS_HOME && chmod -R g+rw $JBOSS_HOME
USER jboss

refactor: rework tomcat-manager, wildfly-manager & vertx-gateway to use ARGs for versions

To enable easier overriding of version numbers at build-time, we use ARGs.

Use `--build-arg` with `docker build`. For example `--build-arg APIMAN_VERSION=4.0.0-SNAPSHOT`.