-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
29 lines (22 loc) · 887 Bytes
/
Dockerfile
File metadata and controls
29 lines (22 loc) · 887 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# Stage 1: Build the JAR
FROM eclipse-temurin:17-jdk AS builder
WORKDIR /app
# Copy only the files needed for dependency resolution (optimizes caching)
COPY pom.xml .
COPY .mvn .mvn
COPY mvnw .
RUN ./mvnw dependency:go-offline -B
# Copy source code and build
COPY src src
RUN ./mvnw clean package -DskipTests && \
ls -la target/ # Debug: Verify JAR creation
# Stage 2: Runtime image
FROM eclipse-temurin:17-jre
WORKDIR /app
# Copy the built JAR (using the exact name from pom.xml's <finalName>)
COPY --from=builder /app/target/pgbuddy-app.jar app.jar
# Set memory limits (matches your pom.xml settings)
# Increase Metaspace to 128MB and total heap to match Render's 512MB free tier
ENV JAVA_OPTS="-Xmx384m -Xms128m -XX:MaxMetaspaceSize=128m -XX:+UseContainerSupport"
# Run with exec form for proper signal handling
ENTRYPOINT ["sh", "-c", "exec java $JAVA_OPTS -jar app.jar"]