Files
gremiumhub/legalconsenthub-backend/Dockerfile

51 lines
1.3 KiB
Docker

FROM eclipse-temurin:21-jdk-alpine AS builder
WORKDIR /workspace/app
RUN mkdir -p ../api
COPY api/legalconsenthub.yml ../api/
COPY legalconsenthub-backend/gradlew .
COPY legalconsenthub-backend/gradle gradle
COPY legalconsenthub-backend/build.gradle .
COPY legalconsenthub-backend/settings.gradle .
RUN chmod +x ./gradlew
RUN ./gradlew dependencies --no-daemon
COPY legalconsenthub-backend/src src
RUN ./gradlew bootJar -x test --no-daemon
FROM eclipse-temurin:21-jre-alpine AS runner
WORKDIR /app
# Install TeXLive and LuaLaTeX
RUN apk add --no-cache \
texlive-luatex \
texmf-dist-plaingeneric \
texmf-dist-latexrecommended \
texmf-dist-latexextra \
texmf-dist-langgerman \
texmf-dist-fontsextra
RUN addgroup -S spring && adduser -S spring -G spring
# PDF cache directory must be writable by the non-root user (and ideally mounted as a volume in production)
RUN mkdir -p /var/lib/legalconsenthub/pdfs && chown -R spring:spring /var/lib/legalconsenthub
USER spring:spring
COPY --from=builder /workspace/app/build/libs/*.jar app.jar
ENV SPRING_PROFILES_ACTIVE=prod
ENV JAVA_OPTS="-Xms256m -Xmx512m"
ENV LEGALCONSENTHUB_PDF_STORAGE_FILESYSTEM_BASE_DIR=/var/lib/legalconsenthub/pdfs
EXPOSE 8080
ENTRYPOINT ["sh", "-c", "java ${JAVA_OPTS} -jar /app/app.jar"]