44 lines
1.2 KiB
Docker
44 lines
1.2 KiB
Docker
FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS base
|
|
WORKDIR /app
|
|
EXPOSE 80
|
|
EXPOSE 443
|
|
# Copy the certificate
|
|
COPY aspnetcore.pfx /https/aspnetcore.pfx
|
|
RUN ls /https && ls /https/aspnetcore.pfx && echo "Certificate copied successfully."
|
|
ENV ASPNETCORE_URLS=https://+;http://+
|
|
ENV ASPNETCORE_HTTPS_PORT=443
|
|
ENV ASPNETCORE_Kestrel__Certificates__Default__Password=test
|
|
ENV ASPNETCORE_Kestrel__Certificates__Default__Path=/https/aspnetcore.pfx
|
|
|
|
FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build
|
|
# Install Node.js
|
|
RUN curl -fsSL https://deb.nodesource.com/setup_20.x | bash - \
|
|
&& apt-get install -y nodejs \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
WORKDIR /src
|
|
COPY PosterMaker.UI.csproj .
|
|
RUN dotnet restore PosterMaker.UI.csproj
|
|
COPY . .
|
|
|
|
# Build Angular app
|
|
WORKDIR "/src/ClientApp"
|
|
RUN npm install
|
|
RUN npm run build --prod
|
|
|
|
# Build .NET app
|
|
WORKDIR "/src"
|
|
RUN dotnet build PosterMaker.UI.csproj -c Release -o /app/build
|
|
|
|
FROM build AS publish
|
|
RUN dotnet publish PosterMaker.UI.csproj -c Release -o /app/publish /p:UseAppHost=false
|
|
|
|
FROM base AS final
|
|
WORKDIR /app
|
|
COPY --from=publish /app/publish .
|
|
|
|
# Copy Angular build output to wwwroot
|
|
COPY --from=build /src/ClientApp/dist /app/wwwroot
|
|
|
|
# Ensure SpaProxy properly configured
|
|
ENTRYPOINT ["dotnet", "PosterMaker.UI.dll"] |