ARG PROJECT=Strata.RxNorm ARG VERSION=0.0.0 ############## # Base image # ############## FROM ecr.ops.stratanetwork.net/strata.microsoft.dotnet.aspnet:8.0 AS base # Add TMZ files for CST RUN cp /usr/share/zoneinfo/America/Chicago "/usr/share/zoneinfo/Central Standard Time" ############### # Build image # ############### FROM ecr.ops.stratanetwork.net/strata.microsoft.dotnet.sdk:8.0 as build ARG PROJECT ARG VERSION # Add TMZ files for CST RUN cp /usr/share/zoneinfo/America/Chicago "/usr/share/zoneinfo/Central Standard Time" WORKDIR /src # Copy project files and restore COPY ["${PROJECT}.sln", "${PROJECT}.sln"] COPY src/**/*.csproj ./ RUN for file in $(ls *.csproj); do mkdir -p src/${file%.*}/ && mv $file src/${file%.*}/; done COPY tests/**/*.csproj ./ RUN for file in $(ls *.csproj); do mkdir -p tests/${file%.*}/ && mv $file tests/${file%.*}/; done RUN dotnet restore "${PROJECT}.sln" \ --source https://api.nuget.org/v3/index.json \ --source https://proget.sdt.local/nuget/nuget/v3/index.json # Copy files and build COPY . . RUN dotnet build "${PROJECT}.sln" \ --configuration Release \ --no-restore # Publish project RUN dotnet publish "src/${PROJECT}.Hangfire/${PROJECT}.Hangfire.csproj" \ --configuration Release \ --no-restore \ --no-build \ --output /app ############### # Final image # ############### FROM base AS final ARG PROJECT WORKDIR /app ARG PROJECT ENV PROJECTDLL=${PROJECT}.Hangfire.dll ENV DOTNET_ENVIRONMENT=Development ENV ASPNETCORE_ENVIRONMENT=Development COPY --from=build /app /app ENTRYPOINT dotnet ${PROJECTDLL}