From b7f8dec65844579e67862361a01bcc4b58992758 Mon Sep 17 00:00:00 2001 From: Clivia <132346501+Yanyutin753@users.noreply.github.com> Date: Sat, 17 Feb 2024 15:31:27 +0800 Subject: [PATCH] Update Dockerfile --- Dockerfiles/Dockerfile | 25 +++++++++++-------------- 1 file changed, 11 insertions(+), 14 deletions(-) diff --git a/Dockerfiles/Dockerfile b/Dockerfiles/Dockerfile index 858aa5a..c9f5b8c 100644 --- a/Dockerfiles/Dockerfile +++ b/Dockerfiles/Dockerfile @@ -1,23 +1,20 @@ # Using Oracle GraalVM for JDK 17 FROM devatherock/graalvm:21-ol8 AS builder -# Set the working directory to /build +# Set the working directory to /home/app WORKDIR /build - # Copy the source code into the image for building COPY . /build - -# Add execute permission to mvnw script and build -RUN chmod +x mvnw && \ - ./mvnw --no-transfer-progress package -Pnative && \ +# Add execute permission to mvnw script +RUN chmod +x mvnw +# Build +RUN ./mvnw --no-transfer-progress native:compile -Pnative && \ rm -rf /root/.m2 -# Use Scratch as base image -FROM scratch - -# Copy the tzdata from builder image -COPY --from=builder /usr/share/zoneinfo /usr/share/zoneinfo - +# Use a lightweight Linux base image with just enough runtime dependencies +FROM alpine:latest +# Expose port 8080 for the application +EXPOSE 8080 # Copy the native executable into the containers -COPY --from=builder /build/target/gpt-4-copilot app -ENTRYPOINT ["/app"] +COPY --from=builder /build/target/gpt-4-copilot gpt-4-copilot +ENTRYPOINT ["/gpt-4-copilot"]