From 1a0b91b4aca95303e9e60a865037c2223daecf17 Mon Sep 17 00:00:00 2001 From: Szymon Uglis Date: Fri, 29 Nov 2024 13:31:55 +0100 Subject: [PATCH] Improve docker image size --- Dockerfile | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index 33ac38e..46bcb59 100644 --- a/Dockerfile +++ b/Dockerfile @@ -7,12 +7,19 @@ RUN dart pub get COPY . /app RUN dart pub get --offline -FROM build as dev +FROM build AS dev CMD [ "dart", "run", "bin/running_on_dart.dart" ] -FROM build as prod +FROM build AS build_prod RUN dart run nyxx_commands:compile bin/running_on_dart.dart -o bot -CMD [ "./bot.exe" ] \ No newline at end of file +FROM scratch AS prod + +WORKDIR /app + +COPY --from=build_prod /runtime / +COPY --from=build_prod /app/** /app + +CMD [ "./bot.exe" ]