forked from th-schwarz/DynDRest
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
31 lines (22 loc) · 975 Bytes
/
Copy pathDockerfile
File metadata and controls
31 lines (22 loc) · 975 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
30
31
# Multi-stage build: build the Spring Boot fat JAR, then run it on a slim JRE image
# ---- Build stage ----
FROM maven:3.9-amazoncorretto-17 AS build
WORKDIR /src
# Copy pom and sources
COPY pom.xml .
COPY src ./src
# Project relies on a local fake repository used during build
COPY fake-repo ./fake-repo
# Build the application (skip tests for faster container build)
RUN mvn -B -DskipTests package
# ---- Runtime stage ----
FROM eclipse-temurin:17-jre-jammy
# curl install curl for an easier health check
RUN apt-get update && apt-get install -y curl && rm -rf /var/lib/apt/lists/*
WORKDIR /app
# Expose the default HTTP port used by DynDRest when running in container
EXPOSE 8080
# Copy the built Spring Boot fat JAR to a fixed path outside /app so mounting /app won't hide the JAR
# Keep WORKDIR at /app with no subdirectories for config and H2 database files
COPY --from=build /src/target/dyndrest-*.jar /dyndrest.jar
ENTRYPOINT ["java","-jar","/dyndrest.jar"]