feat: propper db persistence w/ docker support

This commit is contained in:
Finn Linck Ryan 2025-12-13 21:54:04 +01:00
parent 2c4995f9d7
commit 4c3d939d9a
9 changed files with 276 additions and 160 deletions

View file

@ -1,6 +1,13 @@
# --- Stage 1: Build the JAR ---
FROM gradle:9.2.1-jdk21 AS build
ARG DB_URL
ARG DB_USERNAME
ARG DB_PASSWORD
ENV DB_URL=${DB_URL}
ENV DB_USERNAME=${DB_USERNAME}
ENV DB_PASSWORD=${DB_PASSWORD}
# Set working dir
WORKDIR /app
@ -12,18 +19,20 @@ COPY --chown=gradle:gradle gradle ./gradle
COPY --chown=gradle:gradle src ./src
# Build the fat jar
RUN ./gradlew clean shadowJar --no-daemon
RUN ./gradlew clean build --no-daemon
# --- Stage 2: Run the app ---
FROM eclipse-temurin:21-jdk-alpine
ARG PORT=9000
WORKDIR /app
# Copy the built JAR from the build stage
COPY --from=build /app/build/libs/*.jar app.jar
# Expose port (same as your server)
EXPOSE 9000
EXPOSE ${PORT}
# Run the app
ENTRYPOINT ["java", "-jar", "app.jar"]