Skip to content
This repository was archived by the owner on Nov 23, 2025. It is now read-only.

Commit e39724c

Browse files
committed
feat: Add Dockerfile for building and running the microservice
1 parent 13afb0e commit e39724c

1 file changed

Lines changed: 34 additions & 0 deletions

File tree

Dockerfile

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# Dockerfile for admin-service
2+
3+
# --- Build Stage ---
4+
# Use the official Maven image which contains the Java JDK
5+
FROM maven:3.8-eclipse-temurin-17 AS build
6+
7+
# Set the working directory
8+
WORKDIR /app
9+
10+
# Copy the pom.xml and download dependencies
11+
COPY admin-service/pom.xml .
12+
RUN mvn -B dependency:go-offline
13+
14+
# Copy the rest of the source code and build the application
15+
# Note: We copy the pom.xml *first* to leverage Docker layer caching.
16+
COPY admin-service/src ./src
17+
RUN mvn -B clean package -DskipTests
18+
19+
# --- Run Stage ---
20+
# Use a minimal JRE image for the final container
21+
FROM eclipse-temurin:17-jre-jammy
22+
23+
# Set a working directory
24+
WORKDIR /app
25+
26+
# Copy the built JAR from the 'build' stage
27+
# The wildcard is used in case the version number is in the JAR name
28+
COPY --from=build /app/target/*.jar app.jar
29+
30+
# Expose the port your application runs on
31+
EXPOSE 8087
32+
33+
# The command to run your application
34+
ENTRYPOINT ["java", "-jar", "app.jar"]

0 commit comments

Comments
 (0)