Files
backend/Dockerfile

24 lines
529 B
Docker
Raw Permalink Normal View History

2025-07-20 16:55:23 +08:00
# 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
2025-09-11 14:11:34 +08:00
# Expose port 9090
EXPOSE 9090
2025-07-20 16:55:23 +08:00
# Run the jar file
CMD ["java", "-jar", "target/chat-0.0.1-SNAPSHOT.jar"]