From 0a8083d4d589624f5d0ff9106f8216c64a002c30 Mon Sep 17 00:00:00 2001 From: Slava <20563034+veaceslavdoina@users.noreply.github.com> Date: Sun, 31 Mar 2024 22:18:48 +0300 Subject: [PATCH 1/2] Use multi-stage builds for Rewarder --- Tools/TestNetRewarder/docker/Dockerfile | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/Tools/TestNetRewarder/docker/Dockerfile b/Tools/TestNetRewarder/docker/Dockerfile index 1a96c3f..49f56e2 100644 --- a/Tools/TestNetRewarder/docker/Dockerfile +++ b/Tools/TestNetRewarder/docker/Dockerfile @@ -1,13 +1,26 @@ # Variables -ARG IMAGE=mcr.microsoft.com/dotnet/sdk:7.0 +ARG BUILDER=mcr.microsoft.com/dotnet/sdk:7.0 +ARG IMAGE=${BUILDER} ARG APP_HOME=/app -# Create -FROM ${IMAGE} + +# Build +FROM ${IMAGE} AS builder ARG APP_HOME WORKDIR ${APP_HOME} COPY ./Tools/TestNetRewarder ./Tools/TestNetRewarder COPY ./Framework ./Framework COPY ./ProjectPlugins ./ProjectPlugins -CMD ["dotnet", "run", "--project", "Tools/TestNetRewarder"] +RUN dotnet restore Tools/TestNetRewarder +RUN dotnet publish Tools/TestNetRewarder -c Release -o out + + +# Create +FROM ${IMAGE} +ARG APP_HOME +ENV APP_HOME=${APP_HOME} + +WORKDIR ${APP_HOME} +COPY --from=builder ${APP_HOME}/out . +CMD dotnet ${APP_HOME}/TestNetRewarder.dll From a58c9aba59ce353258e8b90467af933729f17704 Mon Sep 17 00:00:00 2001 From: Slava <20563034+veaceslavdoina@users.noreply.github.com> Date: Mon, 1 Apr 2024 11:05:17 +0300 Subject: [PATCH 2/2] Use multi-stage builds for BiblioTech --- Tools/BiblioTech/docker/Dockerfile | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/Tools/BiblioTech/docker/Dockerfile b/Tools/BiblioTech/docker/Dockerfile index 98df2fb..c1072dc 100644 --- a/Tools/BiblioTech/docker/Dockerfile +++ b/Tools/BiblioTech/docker/Dockerfile @@ -1,14 +1,26 @@ # Variables -ARG IMAGE=mcr.microsoft.com/dotnet/sdk:7.0 +ARG BUILDER=mcr.microsoft.com/dotnet/sdk:7.0 +ARG IMAGE=${BUILDER} ARG APP_HOME=/app -# Create -FROM ${IMAGE} + +# Build +FROM ${IMAGE} AS builder ARG APP_HOME WORKDIR ${APP_HOME} COPY ./Tools/BiblioTech ./Tools/BiblioTech COPY ./Framework ./Framework COPY ./ProjectPlugins ./ProjectPlugins -CMD ["dotnet", "run", "--project", "Tools/BiblioTech"] +RUN dotnet restore Tools/BiblioTech +RUN dotnet publish Tools/BiblioTech -c Release -o out + +# Create +FROM ${IMAGE} +ARG APP_HOME +ENV APP_HOME=${APP_HOME} + +WORKDIR ${APP_HOME} +COPY --from=builder ${APP_HOME}/out . +CMD dotnet ${APP_HOME}/BiblioTech.dll