Update Dockerfile-do

This commit is contained in:
Anthony Stirling 2023-07-29 13:28:14 +01:00 committed by GitHub
parent d86c1820df
commit 1e1e03e6cb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,17 +1,17 @@
# Build stage # Build stage
FROM openjdk:17-jdk-slim AS build FROM alpine:3.14 AS downloader
# Set the current working directory # Install necessary utilities
WORKDIR /app RUN apk add --no-cache curl jq
# Copy everything into the current directory in the image # Set work directory
COPY . . WORKDIR /downloader
# Give execution permissions to gradlew # Fetch the latest release jar from GitHub
RUN chmod +x ./gradlew 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
# Run the build
RUN ./gradlew build
# Production stage # Production stage
FROM frooodle/stirling-pdf-base:beta4 FROM frooodle/stirling-pdf-base:beta4
@ -25,8 +25,8 @@ RUN mkdir /usr/share/fonts/opentype/noto/
COPY src/main/resources/static/fonts/*.ttf /usr/share/fonts/opentype/noto/ COPY src/main/resources/static/fonts/*.ttf /usr/share/fonts/opentype/noto/
RUN fc-cache -f -v RUN fc-cache -f -v
# Copy the application JAR file from the build stage # Copy the application JAR file from the download stage
COPY --from=build /app/build/libs/*.jar app.jar COPY --from=downloader /downloader/Stirling-PDF.jar /app.jar
# Expose the application port # Expose the application port
EXPOSE 8080 EXPOSE 8080