98 lines
2.6 KiB
Docker
98 lines
2.6 KiB
Docker
ARG PROJECT=Strata.SqlTools.QueryBreakdown
|
|
ARG VERSION=0.0.0
|
|
|
|
###############
|
|
# Build image #
|
|
###############
|
|
FROM ecr.ops.stratanetwork.net/strata.microsoft.dotnet.sdk:8.0 AS build
|
|
ARG PROJECT
|
|
ARG VERSION
|
|
|
|
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-dev \
|
|
libgdiplus \
|
|
libx11-dev \
|
|
ttf-mscorefonts-installer \
|
|
fontconfig \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
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
|
|
|
|
# Run unit tests
|
|
RUN dotnet test "${PROJECT}.sln" \
|
|
--configuration Release \
|
|
--no-restore \
|
|
--no-build \
|
|
--verbosity=normal \
|
|
-p:CollectCoverage=true \
|
|
-p:CoverletOutputFormat="opencover" \
|
|
-p:CoverletOutput=/src/cover.xml
|
|
|
|
# Publish project
|
|
RUN dotnet pack "src/Strata.SqlTools.SqlBreakdown/Strata.SqlTools.SqlBreakdown.csproj" \
|
|
--configuration Release \
|
|
--no-restore \
|
|
--no-build \
|
|
--include-symbols \
|
|
--include-source \
|
|
--output /pack \
|
|
-property:PackageVersion=${VERSION}
|
|
|
|
RUN dotnet pack "src/Strata.SqlTools.Markdown/Strata.SqlTools.Markdown.csproj" \
|
|
--configuration Release \
|
|
--no-restore \
|
|
--no-build \
|
|
--include-symbols \
|
|
--include-source \
|
|
--output /pack \
|
|
-property:PackageVersion=${VERSION}
|
|
|
|
RUN dotnet pack "src/Strata.SqlTools.Rules/Strata.SqlTools.Rules.csproj" \
|
|
--configuration Release \
|
|
--no-restore \
|
|
--no-build \
|
|
--include-symbols \
|
|
--include-source \
|
|
--output /pack \
|
|
-property:PackageVersion=${VERSION}
|
|
|
|
RUN dotnet pack "src/Strata.SqlTools.SqlServer/Strata.SqlTools.SqlServer.csproj" \
|
|
--configuration Release \
|
|
--no-restore \
|
|
--no-build \
|
|
--include-symbols \
|
|
--include-source \
|
|
--output /pack \
|
|
-property:PackageVersion=${VERSION}
|
|
|
|
RUN dotnet pack "src/Strata.SqlTools.Snowflake/Strata.SqlTools.Snowflake.csproj" \
|
|
--configuration Release \
|
|
--no-restore \
|
|
--no-build \
|
|
--include-symbols \
|
|
--include-source \
|
|
--output /pack \
|
|
-property:PackageVersion=${VERSION}
|