更新 Dockerfile

This commit is contained in:
Clivia
2024-02-17 14:54:02 +08:00
committed by GitHub
parent 798f95d339
commit 8c3ac36473

View File

@@ -1,5 +1,5 @@
# Using Oracle GraalVM for JDK 17 # Using Oracle GraalVM for JDK 17
FROM devatherock/graalvm:21-ol8 AS builder FROM oracle/graalvm-ce:21.0.0.2 as builder
# Set the working directory to /build # Set the working directory to /build
WORKDIR /build WORKDIR /build
@@ -9,20 +9,17 @@ COPY . /build
# Add execute permission to mvnw script and build # Add execute permission to mvnw script and build
RUN chmod +x mvnw && \ RUN chmod +x mvnw && \
./mvnw --no-transfer-progress native:compile -Pnative && \ ./mvnw --no-transfer-progress package -Pnative && \
rm -rf /root/.m2 rm -rf /root/.m2
# Use Distroless as base image # Use Scratch as base image
FROM alpine:latest FROM scratch
RUN apk update \ # Copy the tzdata from builder image
&& apk upgrade \ COPY --from=builder /usr/share/zoneinfo /usr/share/zoneinfo
&& apk add --no-cache tzdata
# Copy the native executable into the containers # Copy the native executable into the containers
COPY --from=builder /build/target/gpt-4-copilot /config/gpt-4-copilot COPY --from=builder /build/target/gpt-4-copilot /gpt-4-copilot
# Set the entrypoint # Set the entrypoint
ENTRYPOINT ["/config/gpt-4-copilot"] ENTRYPOINT ["/gpt-4-copilot"]