FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build WORKDIR /src # Copy csproj and restore dependencies COPY ["SessionZero.sln", "./"] COPY ["SessionZero/SessionZero.csproj", "SessionZero/"] RUN dotnet restore # Copy the rest of the files and build COPY . . RUN dotnet build "SessionZero/SessionZero.csproj" -c Release -o /app/build # Publish the application RUN dotnet publish "SessionZero/SessionZero.csproj" -c Release -o /app/publish # Use the official ASP.NET Core runtime image FROM nginx:alpine AS final WORKDIR /usr/share/nginx/html COPY --from=build /app/publish/wwwroot . COPY nginx.conf /etc/nginx/nginx.conf COPY init-letsencrypt.sh /init-letsencrypt.sh # Install certbot and dependencies RUN apk add --no-cache certbot certbot-nginx bash # Make init script executable RUN chmod +x /init-letsencrypt.sh EXPOSE 80 EXPOSE 443 # Add entrypoint script to run certbot and nginx COPY docker-entrypoint.sh /docker-entrypoint.sh RUN chmod +x /docker-entrypoint.sh ENTRYPOINT ["/docker-entrypoint.sh"]