Skip to content

Commit d9f4f8d

Browse files
committed
Update Dockerfile (#190)
1 parent 728b20b commit d9f4f8d

File tree

1 file changed

+29
-13
lines changed

1 file changed

+29
-13
lines changed

src/AliasVault.Client/Dockerfile

Lines changed: 29 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,49 @@
11
FROM mcr.microsoft.com/dotnet/aspnet:9.0 AS base
22
WORKDIR /app
33

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
56
ARG BUILD_CONFIGURATION=Release
67
ENV DOTNET_CLI_TELEMETRY_OPTOUT=1
78
ENV MSBUILDDEBUGPATH=/src/msbuild-logs
8-
WORKDIR /src
9+
WORKDIR /source
910

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
1213

1314
# Install the WebAssembly tools
1415
RUN dotnet workload install wasm-tools
1516

16-
# Copy the project files and restore dependencies
17+
# Copy all project files first
1718
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
1933
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
2440

2541
# Final stage
26-
FROM nginx:1.24.0 AS final
42+
FROM nginx:1.24.0-alpine
2743
WORKDIR /usr/share/nginx/html
2844
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
3147

3248
RUN chmod +x /app/entrypoint.sh
3349

0 commit comments

Comments
 (0)