|
1 | 1 | FROM mcr.microsoft.com/dotnet/aspnet:9.0 AS base |
2 | 2 | WORKDIR /app |
3 | 3 |
|
4 | | -FROM mcr.microsoft.com/dotnet/sdk:9.0 AS build |
| 4 | +FROM --platform=$BUILDPLATFORM mcr.microsoft.com/dotnet/sdk:9.0 AS build |
| 5 | +ARG TARGETARCH |
5 | 6 | ARG BUILD_CONFIGURATION=Release |
6 | 7 | ENV DOTNET_CLI_TELEMETRY_OPTOUT=1 |
7 | 8 | ENV MSBUILDDEBUGPATH=/src/msbuild-logs |
8 | | -WORKDIR /src |
| 9 | +WORKDIR /source |
9 | 10 |
|
10 | | -# Create the debug directory and install Python which is required by the WebAssembly tools |
11 | | -RUN mkdir -p /src/msbuild-logs && apt-get update && apt-get install -y python3 && apt-get clean |
| 11 | +# Install Python which is required by the WebAssembly tools |
| 12 | +RUN apt-get update && apt-get install -y python3 && apt-get clean |
12 | 13 |
|
13 | 14 | # Install the WebAssembly tools |
14 | 15 | RUN dotnet workload install wasm-tools |
15 | 16 |
|
16 | | -# Copy the project files and restore dependencies |
| 17 | +# Copy all project files first |
17 | 18 | COPY ["src/AliasVault.Client/AliasVault.Client.csproj", "src/AliasVault.Client/"] |
18 | | -RUN dotnet restore "src/AliasVault.Client/AliasVault.Client.csproj" |
| 19 | +COPY ["src/Databases/AliasClientDb/AliasClientDb.csproj", "src/Databases/AliasClientDb/"] |
| 20 | +COPY ["src/Utilities/Cryptography/AliasVault.Cryptography.Client/AliasVault.Cryptography.Client.csproj", "src/Utilities/Cryptography/AliasVault.Cryptography.Client/"] |
| 21 | +COPY ["src/Utilities/AliasVault.FaviconExtractor/AliasVault.FaviconExtractor.csproj", "src/Utilities/AliasVault.FaviconExtractor/"] |
| 22 | +COPY ["src/Generators/AliasVault.Generators.Identity/AliasVault.Generators.Identity.csproj", "src/Generators/AliasVault.Generators.Identity/"] |
| 23 | +COPY ["src/Utilities/AliasVault.CsvImportExport/AliasVault.CsvImportExport.csproj", "src/Utilities/AliasVault.CsvImportExport/"] |
| 24 | +COPY ["src/Shared/AliasVault.Shared/AliasVault.Shared.csproj", "src/Shared/AliasVault.Shared/"] |
| 25 | +COPY ["src/Shared/AliasVault.Shared.Core/AliasVault.Shared.Core.csproj", "src/Shared/AliasVault.Shared.Core/"] |
| 26 | +COPY ["src/Generators/AliasVault.Generators.Password/AliasVault.Generators.Password.csproj", "src/Generators/AliasVault.Generators.Password/"] |
| 27 | +COPY ["src/Shared/AliasVault.RazorComponents/AliasVault.RazorComponents.csproj", "src/Shared/AliasVault.RazorComponents/"] |
| 28 | + |
| 29 | +# Restore all packages |
| 30 | +RUN dotnet restore "src/AliasVault.Client/AliasVault.Client.csproj" -a $TARGETARCH |
| 31 | + |
| 32 | +# Copy everything else and build |
19 | 33 | COPY . . |
20 | | - |
21 | | -# Build and publish |
22 | | -WORKDIR "/src/src/AliasVault.Client" |
23 | | -RUN dotnet publish "AliasVault.Client.csproj" -c "$BUILD_CONFIGURATION" -o /app/publish /p:UseAppHost=false |
| 34 | +RUN dotnet publish "src/AliasVault.Client/AliasVault.Client.csproj" \ |
| 35 | + -a $TARGETARCH \ |
| 36 | + -c "$BUILD_CONFIGURATION" \ |
| 37 | + --no-restore \ |
| 38 | + -o /app/publish \ |
| 39 | + /p:UseAppHost=false |
24 | 40 |
|
25 | 41 | # Final stage |
26 | | -FROM nginx:1.24.0 AS final |
| 42 | +FROM nginx:1.24.0-alpine |
27 | 43 | WORKDIR /usr/share/nginx/html |
28 | 44 | COPY --from=build /app/publish/wwwroot . |
29 | | -COPY /src/AliasVault.Client/nginx.conf /etc/nginx/nginx.conf |
30 | | -COPY /src/AliasVault.Client/entrypoint.sh /app/entrypoint.sh |
| 45 | +COPY src/AliasVault.Client/nginx.conf /etc/nginx/nginx.conf |
| 46 | +COPY src/AliasVault.Client/entrypoint.sh /app/entrypoint.sh |
31 | 47 |
|
32 | 48 | RUN chmod +x /app/entrypoint.sh |
33 | 49 |
|
|
0 commit comments