Skip to content

Commit 9b8066e

Browse files
committed
fix server dockerfile placement
1 parent 693bfde commit 9b8066e

File tree

2 files changed

+35
-25
lines changed

2 files changed

+35
-25
lines changed

Dockerfile

Lines changed: 0 additions & 25 deletions
This file was deleted.

server/Dockerfile

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# Stage 1: Build server with Maven
2+
FROM maven:3-eclipse-temurin-21 AS build
3+
4+
WORKDIR /workspace
5+
6+
# Copy POM and source code
7+
COPY pom.xml ./
8+
COPY src ./src
9+
10+
# Build the application
11+
RUN mvn package -DskipTests -B -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn
12+
13+
# Extract dependencies for layer caching
14+
RUN mkdir -p target/dependency && (cd target/dependency; jar -xf ../*.jar)
15+
16+
# Stage 2: Runtime image
17+
FROM bellsoft/liberica-openjre-alpine-musl:25
18+
19+
VOLUME /tmp
20+
21+
ARG DEPENDENCY=/workspace/target/dependency
22+
ARG SPRING_PROFILES_ACTIVE=prod
23+
24+
RUN apk add postgresql17-client curl
25+
26+
# Copy application layers
27+
COPY --from=build ${DEPENDENCY}/BOOT-INF/lib /app/lib
28+
COPY --from=build ${DEPENDENCY}/META-INF /app/META-INF
29+
COPY --from=build ${DEPENDENCY}/BOOT-INF/classes /app
30+
31+
# Set environment variables
32+
ENV SPRING_PROFILES_ACTIVE=${SPRING_PROFILES_ACTIVE}
33+
34+
# Run the application
35+
ENTRYPOINT ["java", "-cp", "app:app/lib/*", "io.github.mucsi96.postgresbackuptool.App"]

0 commit comments

Comments
 (0)