Newer
Older
dockerfiles / plantuml.dockerfile
FROM eclipse-temurin:17-jdk-alpine as jre-build

RUN \
	apk add --no-cache binutils

# generate a minimal JRE that includes only the necessary modules
RUN $JAVA_HOME/bin/jlink \
         --add-modules java.base,java.desktop,java.management,java.instrument,java.naming \
         --strip-debug \
         --no-man-pages \
         --no-header-files \
         --compress=2 \
         --output /jre

FROM alpine:3.15

ENV JAVA_HOME=/opt/java/openjdk
ENV PATH "${JAVA_HOME}/bin:${PATH}"

COPY --from=jre-build /jre $JAVA_HOME

ENV \
	JETTY_VERSION=11.0.8 \
	PLANTUML_VERSION=v1.2022.0 \
	JETTY_HOME=/home/jetty/jetty-home \
	JETTY_BASE=/home/jetty

RUN \
	apk add --no-cache \
		graphviz \
		curl \
		ttf-opensans && \
	apk add --no-cache --repository=http://dl-cdn.alpinelinux.org/alpine/edge/testing font-roboto

RUN \
	addgroup jetty && adduser -D -G jetty jetty

USER jetty

WORKDIR /home/jetty

RUN \
	wget -O - https://repo1.maven.org/maven2/org/eclipse/jetty/jetty-home/${JETTY_VERSION}/jetty-home-${JETTY_VERSION}.tar.gz | gzip -d | tar xf - && \
	java -jar ${JETTY_HOME}-${JETTY_VERSION}/start.jar --add-modules=http,jsp,deploy && \
	wget -O webapps/plantuml.war https://github.com/plantuml/plantuml-server/releases/download/${PLANTUML_VERSION}/plantuml-${PLANTUML_VERSION}.war

EXPOSE 8080/tcp

HEALTHCHECK --interval=5m --timeout=5s CMD curl --fail http://localhost:8080/plantuml-v1.2022.0/txt/Iyv9B2vMA4ajBW40 || exit 1

CMD /opt/java/openjdk/bin/java -Xms128m -Xms256m -jar ${JETTY_HOME}-${JETTY_VERSION}/start.jar