uncloseai.com/languages/java/openai/Dockerfile

26 lines
582 B
Docker

# Use official Maven image to build
FROM maven:3.9-eclipse-temurin-17-alpine AS builder
WORKDIR /app
# Copy POM and source
COPY pom.xml ./
COPY uncloseai.java ./
# Build the application
RUN mvn clean compile
# Run stage
FROM eclipse-temurin:17-jre-alpine
WORKDIR /app
# Copy compiled classes and dependencies from builder
COPY --from=builder /app/target/classes ./classes
COPY --from=builder /root/.m2/repository /root/.m2/repository
COPY --from=builder /app/pom.xml ./
# Install maven to have classpath available
RUN apk add --no-cache maven
CMD ["mvn", "-q", "exec:java"]