24 lines
529 B
Docker
24 lines
529 B
Docker
# Use official OpenJDK 17 runtime as base image
|
|
FROM openjdk:17-jdk-slim
|
|
|
|
# Set working directory
|
|
WORKDIR /app
|
|
|
|
# Copy Maven wrapper and pom.xml first for better layer caching
|
|
COPY .mvn/ .mvn/
|
|
COPY mvnw pom.xml ./
|
|
|
|
# Download dependencies (this layer will be cached unless pom.xml changes)
|
|
RUN ./mvnw dependency:go-offline -B
|
|
|
|
# Copy source code
|
|
COPY src ./src
|
|
|
|
# Build the application
|
|
RUN ./mvnw clean package -DskipTests
|
|
|
|
# Expose port 9090
|
|
EXPOSE 9090
|
|
|
|
# Run the jar file
|
|
CMD ["java", "-jar", "target/chat-0.0.1-SNAPSHOT.jar"] |