ARG PROJECT=Strata.Stratasphere ARG VERSION=0.0.0 ############## # Base image # ############## FROM ecr.ops.stratanetwork.net/strata.microsoft.dotnet.aspnet:6.0 AS base # Add TMZ files for CST RUN cp /usr/share/zoneinfo/America/Chicago "/usr/share/zoneinfo/Central Standard Time" RUN sed -i'.bak' 's/$/ contrib/' /etc/apt/sources.list RUN apt-get update --allow-releaseinfo-change \ && apt-get install -y \ libc6-dev \ libgdiplus \ libx11-dev \ ttf-mscorefonts-installer \ fontconfig \ && rm -rf /var/lib/apt/lists/* ############### # Build image # ############### FROM ecr.ops.stratanetwork.net/strata.microsoft.dotnet.sdk:6.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}.Service/${PROJECT}.Service.csproj" \ --configuration Release \ --no-restore \ --no-build \ --output /app ############### # Final image # ############### FROM base AS final ARG PROJECT WORKDIR /app ARG PROJECT ENV PROJECTDLL=${PROJECT}.Service.dll ENV DOTNET_ENVIRONMENT=Development ENV ASPNETCORE_ENVIRONMENT=Development COPY --from=build /app /app ENTRYPOINT dotnet ${PROJECTDLL}