diff --git a/build.Dockerfile b/build.Dockerfile index 2984e5a622..849531b83c 100644 --- a/build.Dockerfile +++ b/build.Dockerfile @@ -189,3 +189,5 @@ RUN . /tmp/rid.txt && dotnet publish -c release -o /app/Server --no-restore --no # Build Setup app WORKDIR /source/util/Setup RUN . /tmp/rid.txt && dotnet publish -c release -o /app/Setup --no-restore --no-self-contained -r $RID + +WORKDIR /app diff --git a/util/MsSqlMigratorUtility/Dockerfile b/util/MsSqlMigratorUtility/Dockerfile index 1a33ff12d2..11fab9a198 100644 --- a/util/MsSqlMigratorUtility/Dockerfile +++ b/util/MsSqlMigratorUtility/Dockerfile @@ -2,7 +2,22 @@ FROM mcr.microsoft.com/dotnet/aspnet:6.0 LABEL com.bitwarden.product="bitwarden" +# Copy csproj files as distinct layers +WORKDIR /source +COPY util/MsSqlMigratorUtility/*.csproj ./util/MsSqlMigratorUtility/ + +# Restore MsSqlMigratorUtility project dependencies and tools +WORKDIR /source/util/MsSqlMigratorUtility +RUN dotnet restore + +# Copy required project files +WORKDIR /source +COPY util/MsSqlMigratorUtility/. ./util/MsSqlMigratorUtility/ + +# Build Setup app +WORKDIR /source/util/MsSqlMigratorUtility +RUN dotnet publish -c release -o /app/MsSqlMigratorUtility --no-restore --no-self-contained + WORKDIR /app -COPY obj/build-output/publish . ENTRYPOINT ["sh", "-c", "dotnet /app/MsSqlMigratorUtility.dll \"${MSSQL_CONN_STRING}\" -v ${@}", "--" ]