Template
74 lines
2.0 KiB
Docker
74 lines
2.0 KiB
Docker
ARG PROJECT=Strata.ContinuousImprovement
|
|
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"
|
|
|
|
RUN sed -i 's/^Components: main$/& contrib/' /etc/apt/sources.list.d/debian.sources \
|
|
&& apt-get update --allow-releaseinfo-change \
|
|
&& apt-get install -y \
|
|
libc6 \
|
|
libc6-dev \
|
|
libgdiplus \
|
|
libx11-dev \
|
|
ttf-mscorefonts-installer \
|
|
fontconfig \
|
|
&& rm -rf /var/lib/apt/lists/*\
|
|
&& ln -s /usr/lib/x86_64-linux-gnu/libdl.so.2 /usr/lib/x86_64-linux-gnu/libdl.so
|
|
|
|
###############
|
|
# 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}.Dashboard/${PROJECT}.Dashboard.csproj" \
|
|
--configuration Release \
|
|
--no-restore \
|
|
--no-build \
|
|
--output /app
|
|
|
|
###############
|
|
# Final image #
|
|
###############
|
|
FROM base AS final
|
|
ARG PROJECT
|
|
WORKDIR /app
|
|
ARG PROJECT
|
|
ENV PROJECTDLL=${PROJECT}.Dashboard.dll
|
|
ENV DOTNET_ENVIRONMENT=Development
|
|
ENV ASPNETCORE_ENVIRONMENT=Development
|
|
|
|
COPY --from=build /app /app
|
|
ENTRYPOINT dotnet ${PROJECTDLL}
|