Stirling-PDF/Dockerfile2

38 lines
989 B
Plaintext
Raw Normal View History

2023-07-29 00:36:49 +01:00
# Build stage
2023-07-29 13:28:14 +01:00
FROM alpine:3.14 AS downloader
2023-07-29 00:36:49 +01:00
2023-07-29 13:28:14 +01:00
# Install necessary utilities
RUN apk add --no-cache curl jq
2023-07-29 00:36:49 +01:00
2023-07-29 13:28:14 +01:00
# Set work directory
WORKDIR /downloader
2023-07-29 00:36:49 +01:00
2023-07-29 13:28:14 +01:00
# 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
2023-07-29 00:51:28 +01:00
2023-07-29 00:36:49 +01:00
# 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
2023-07-29 13:28:14 +01:00
# Copy the application JAR file from the download stage
COPY --from=downloader /downloader/Stirling-PDF.jar /app.jar
2023-07-29 00:36:49 +01:00
# Expose the application port
EXPOSE 8080
# Run the application
RUN chmod +x /scripts/init.sh
ENTRYPOINT ["/scripts/init.sh"]
CMD ["java", "-jar", "/app.jar"]