# Build stage FROM alpine:3.14 AS downloader # Install necessary utilities RUN apk add --no-cache curl jq # Set work directory WORKDIR /downloader # Fetch the latest release jar from GitHub RUN curl -s https://api.github.com/repos/Frooodle/Stirling-PDF/releases/latest \ | jq -r ".assets[] | select(.name == \"Stirling-PDF.jar\") | .browser_download_url" \ | xargs curl -L -o Stirling-PDF.jar # Production stage FROM frooodle/stirling-pdf-base:beta4 # Create scripts folder and copy local scripts RUN mkdir /scripts COPY ./scripts/* /scripts/ # Install fonts RUN mkdir /usr/share/fonts/opentype/noto/ COPY src/main/resources/static/fonts/*.ttf /usr/share/fonts/opentype/noto/ RUN fc-cache -f -v # Copy the application JAR file from the download stage COPY --from=downloader /downloader/Stirling-PDF.jar /app.jar # Expose the application port EXPOSE 8080 # Run the application RUN chmod +x /scripts/init.sh ENTRYPOINT ["/scripts/init.sh"] CMD ["java", "-jar", "/app.jar"]