1
0
mirror of https://github.com/bitwarden/server.git synced 2025-07-18 16:11:28 -05:00

Fix MsSqlMigratorUtility

This commit is contained in:
Vince Grassia
2023-11-16 09:40:51 -05:00
parent 5aa2b21415
commit 1b2e7a3ed7

View File

@ -2,23 +2,41 @@
# Build stage # # Build stage #
############################################### ###############################################
FROM mcr.microsoft.com/dotnet/sdk:6.0 AS bitwarden-build FROM --platform=$BUILDPLATFORM mcr.microsoft.com/dotnet/sdk:6.0 AS bitwarden-build
# Docker buildx supplies the value for this arg
ARG TARGETPLATFORM
# Determine proper runtime value for .NET
# We put the value in a file to be read by later layers.
RUN if [ "$TARGETPLATFORM" = "linux/amd64" ]; then \
RID=linux-x64 ; \
elif [ "$TARGETPLATFORM" = "linux/arm64" ]; then \
RID=linux-arm64 ; \
elif [ "$TARGETPLATFORM" = "linux/arm/v7" ]; then \
RID=linux-arm ; \
fi \
&& echo "RID=$RID" > /tmp/rid.txt
# Copy csproj files as distinct layers # Copy csproj files as distinct layers
WORKDIR /source WORKDIR /source
COPY src/Core/*.csproj ./src/Core/
COPY util/Migrator/*.csproj ./util/Migrator/
COPY util/MsSqlMigratorUtility/*.csproj ./util/MsSqlMigratorUtility/ COPY util/MsSqlMigratorUtility/*.csproj ./util/MsSqlMigratorUtility/
# Restore MsSqlMigratorUtility project dependencies and tools # Restore MsSqlMigratorUtility project dependencies and tools
WORKDIR /source/util/MsSqlMigratorUtility WORKDIR /source/util/MsSqlMigratorUtility
RUN dotnet restore RUN . /tmp/rid.txt && dotnet restore -r $RID
# Copy required project files # Copy required project files
WORKDIR /source WORKDIR /source
COPY src/Core/. ./src/Core/
COPY util/Migrator/. ./util/Migrator/
COPY util/MsSqlMigratorUtility/. ./util/MsSqlMigratorUtility/ COPY util/MsSqlMigratorUtility/. ./util/MsSqlMigratorUtility/
# Build Setup app # Build MsSqlMigratorUtility app
WORKDIR /source/util/MsSqlMigratorUtility WORKDIR /source/util/MsSqlMigratorUtility
RUN dotnet publish -c release -o /app/MsSqlMigratorUtility --no-restore --no-self-contained RUN . /tmp/rid.txt && dotnet publish -c release -o /app/MsSqlMigratorUtility --no-restore --no-self-contained -r $RID
WORKDIR /app WORKDIR /app
@ -27,6 +45,7 @@ WORKDIR /app
############################################### ###############################################
FROM mcr.microsoft.com/dotnet/aspnet:6.0 FROM mcr.microsoft.com/dotnet/aspnet:6.0
ARG TARGETPLATFORM
LABEL com.bitwarden.product="bitwarden" LABEL com.bitwarden.product="bitwarden"
# Copy app from the build stage # Copy app from the build stage