validator icon indicating copy to clipboard operation
validator copied to clipboard

Add an official Dockerfile

Open sarimak opened this issue 10 months ago • 1 comments

Hi, running the validator in a Docker container currently requires manual creation of the Dockerfile. It would be nice to have an official one, so the validator web service runs as intended by the official authority.

I prepared a Dockerfile on my own, feel free to reuse it as you find it useful:

FROM docker.io/eclipse-temurin:21-jre-alpine

ARG VALIDATOR_VERSION=1.5.0
ARG XRECHNUNG_VERSION=3.0.2
ARG XRECHNUNG_DATE=2024-10-31

WORKDIR /app

RUN apk add --no-cache wget unzip \
    && wget -O validator.zip https://github.com/itplr-kosit/validator/releases/download/v${VALIDATOR_VERSION}/validator-${VALIDATOR_VERSION}-distribution.zip \
    && wget -O xrechnung-config.zip https://github.com/itplr-kosit/validator-configuration-xrechnung/releases/download/release-${XRECHNUNG_DATE}/validator-configuration-xrechnung_${XRECHNUNG_VERSION}_${XRECHNUNG_DATE}.zip \
    && unzip validator.zip validationtool-${VALIDATOR_VERSION}-standalone.jar \
    && mv validationtool-${VALIDATOR_VERSION}-standalone.jar validationtool.jar \
    && mkdir -p scenarios \
    && unzip xrechnung-config.zip -d /app/scenarios \
    && rm -rf validator.zip xrechnung-config.zip \
    && apk del wget unzip

# Enable the debug GUI only when the ENABLE_GUI environment variable is set to "true"
RUN echo '#!/bin/sh' > /app/entrypoint.sh && \
    echo 'COMMAND="java -jar validationtool.jar -r /app/scenarios -s /app/scenarios/scenarios.xml -D -H 0.0.0.0 -P 8080"' >> /app/entrypoint.sh && \
    echo 'if [ "${ENABLE_GUI:-}" != "true" ]; then' >> /app/entrypoint.sh && \
    echo '    COMMAND="${COMMAND} --disable-gui"' >> /app/entrypoint.sh && \
    echo 'fi' >> /app/entrypoint.sh && \
    echo 'exec ${COMMAND}' >> /app/entrypoint.sh

RUN chmod +x /app/entrypoint.sh

EXPOSE 8080

ENTRYPOINT ["/app/entrypoint.sh"]

sarimak avatar Feb 18 '25 16:02 sarimak

Thanks for providing a basic Docker image. We understand the need and will come up with an "official" solution for this.

phax avatar Jul 25 '25 09:07 phax