This commit is contained in:
Tour
2025-12-03 17:17:49 +01:00
parent febd08821a
commit 8fff75dcf2
22 changed files with 4666 additions and 40 deletions

View File

@@ -1,27 +1,34 @@
# Build stage
FROM maven:3.9-eclipse-temurin-11 AS build
WORKDIR /build
COPY pom.xml .
COPY src ./src
RUN mvn clean package -DskipTests
# Build stage - 0
FROM maven:3.9-eclipse-temurin-25-alpine AS build
# Runtime stage - using headless JRE to reduce size
FROM eclipse-temurin:11-jre-jammy
WORKDIR /app
# Install minimal OpenCV runtime libraries (not the full dev package)
RUN apt-get update && \
apt-get install -y --no-install-recommends \
libopencv-core4.5d \
libopencv-imgcodecs4.5d \
libopencv-dnn4.5d && \
rm -rf /var/lib/apt/lists/*
# Copy Maven files
COPY pom.xml ./
# Copy the JAR file
COPY --from=build /build/target/troostwijk-scraper-1.0-SNAPSHOT-jar-with-dependencies.jar app.jar
# Download dependencies (cached layer)
RUN mvn dependency:go-offline -B
# Set OpenCV library path and notification config
ENV LD_LIBRARY_PATH=/usr/lib/x86_64-linux-gnu
ENV NOTIFICATION_CONFIG=desktop
# Copy source
COPY src/ ./src/
ENTRYPOINT ["java", "-Djava.library.path=/usr/lib/x86_64-linux-gnu", "-jar", "/app/app.jar"]
# Build Quarkus application
RUN mvn package -DskipTests -Dquarkus.package.jar.type=uber-jar
# Runtime stage
FROM eclipse-temurin:25-jre-alpine
WORKDIR /app
# Create non-root user
RUN addgroup -g 1001 quarkus && adduser -u 1001 -G quarkus -s /bin/sh -D quarkus
# Copy the uber jar - 5
COPY --from=build --chown=quarkus:quarkus /app/target/*-runner.jar app.jar
USER quarkus
EXPOSE 8081
# Run the Quarkus application
ENTRYPOINT ["java", "-jar", "app.jar"]