feat(infra): 添加 Docker Compose 配置和后端 Dockerfile (T004)

This commit is contained in:
wh
2026-04-09 13:08:49 +08:00
parent fba3701cb9
commit bc33194b6e
3 changed files with 124 additions and 0 deletions

18
Dockerfile Normal file
View File

@@ -0,0 +1,18 @@
# Build stage: uses Maven + JDK 17 (Alpine) to compile and package the application.
FROM maven:3.9-eclipse-temurin-17-alpine AS builder
WORKDIR /app
# Copy pom.xml first to leverage Docker layer caching for dependency downloads.
COPY pom.xml .
RUN mvn dependency:go-offline -q
# Copy source and build the fat JAR, skipping tests.
COPY src ./src
RUN mvn clean package -DskipTests -q
# Runtime stage: slim JRE-only image for a smaller production footprint.
FROM eclipse-temurin:17-jre-alpine
WORKDIR /app
COPY --from=builder /app/target/*.jar app.jar
EXPOSE 8080
ENTRYPOINT ["java", "-jar", "app.jar"]