ShiftScheduler/Dockerfile
copilot-swe-agent[bot] f769dbdd8c Fix Docker build authentication and SSL issues with comprehensive error handling and documentation
Co-authored-by: clayschaad <11883505+clayschaad@users.noreply.github.com>
2025-08-27 18:00:10 +00:00

44 lines
No EOL
1.5 KiB
Docker

# Use the official .NET 9.0 SDK image for building
FROM mcr.microsoft.com/dotnet/sdk:9.0 AS build-env
# Set working directory
WORKDIR /source
# Copy the project files from current directory
# Note: In production, replace this with git clone or download from repository
# For example: RUN git clone https://github.com/clayschaad/ShiftScheduler.git .
COPY . .
# Configure NuGet to bypass SSL certificate validation for package restore
# This is necessary in Docker environments with certificate trust issues
ENV NUGET_CERT_REVOCATION_MODE=offline
RUN dotnet nuget update source nuget.org --source https://api.nuget.org/v3/index.json --configfile ~/.nuget/NuGet/NuGet.Config || \
echo "Warning: Could not update NuGet configuration, proceeding with default settings"
# Restore dependencies
RUN dotnet restore
# Build the application
RUN dotnet build --configuration Release --no-restore
# Publish the application
RUN dotnet publish Server/ShiftScheduler.Server.csproj --configuration Release --no-build --output /app/publish
# Use the official .NET 9.0 runtime image for the final stage
FROM mcr.microsoft.com/dotnet/aspnet:9.0
# Set working directory
WORKDIR /app
# Copy the published application from the build stage
COPY --from=build-env /app/publish .
# Expose the HTTP port (5000 is the default from launchSettings.json)
EXPOSE 5000
# Set environment variables for production
ENV ASPNETCORE_ENVIRONMENT=Production
ENV ASPNETCORE_URLS=http://+:5000
# Run the application
ENTRYPOINT ["dotnet", "ShiftScheduler.Server.dll"]