diff --git a/util/MsSqlMigratorUtility/Dockerfile b/util/MsSqlMigratorUtility/Dockerfile index 561d334088..133beb6fe7 100644 --- a/util/MsSqlMigratorUtility/Dockerfile +++ b/util/MsSqlMigratorUtility/Dockerfile @@ -1,6 +1,8 @@ -FROM mcr.microsoft.com/dotnet/aspnet:6.0 +############################################### +# Build stage # +############################################### -LABEL com.bitwarden.product="bitwarden" +FROM mcr.microsoft.com/dotnet/sdk:6.0 AS bitwarden-build # Copy csproj files as distinct layers WORKDIR /source @@ -20,4 +22,15 @@ RUN dotnet publish -c release -o /app/MsSqlMigratorUtility --no-restore --no-sel WORKDIR /app +############################################### +# App stage # +############################################### +FROM mcr.microsoft.com/dotnet/aspnet:6.0 + +LABEL com.bitwarden.product="bitwarden" + +# Copy app from the build stage +WORKDIR /app +COPY --from=bitwarden-build /app/MsSqlMigratorUtility ./ + ENTRYPOINT ["sh", "-c", "dotnet /app/MsSqlMigratorUtility.dll \"${MSSQL_CONN_STRING}\" -v ${@}", "--" ]