更新 Dockerfile

This commit is contained in:
Clivia
2024-02-17 09:27:32 +08:00
committed by GitHub
parent d7b68683e9
commit f4e3c5e100

View File

@@ -1,25 +1,24 @@
# Using Oracle GraalVM for JDK 17
FROM devatherock/graalvm:21-ol8 AS builder
# Set the working directory to /home/app
# Set the working directory to /build
WORKDIR /build
# Copy the source code into the image for building
COPY . /build
# Add execute permission to mvnw script
RUN chmod +x mvnw
# Add execute permission to mvnw script and build
RUN chmod +x mvnw && \
./mvnw --no-transfer-progress native:compile -Pnative && \
rm -rf /root/.m2
# Build
RUN ./mvnw --no-transfer-progress native:compile -Pnative
# Use a lightweight Linux base image with just enough runtime dependencies
FROM container-registry.oracle.com/os/oraclelinux:8-slim
# Expose port 8080 for the application
EXPOSE 8080
# Use Distroless as base image
FROM gcr.io/distroless/cc-debian10
# Copy the native executable into the containers
COPY --from=builder /build/target/gpt-4-copilot app
COPY --from=builder /build/target/gpt-4-copilot /app
# Set the entrypoint
ENTRYPOINT ["/app"]
ENTRYPOINT ["/app"]