🔧 Streamlines inconsistencies and resolves current issues
This commit is contained in:
+13
-5
@@ -1,5 +1,5 @@
|
|||||||
# syntax=docker/dockerfile:1.20
|
# syntax=docker/dockerfile:1.20
|
||||||
ARG RUNTIME_BASE=app
|
ARG RUNTIME_BASE=web
|
||||||
ARG CONFIGURATION=Release
|
ARG CONFIGURATION=Release
|
||||||
ARG DOTNET_VERSION=10.0
|
ARG DOTNET_VERSION=10.0
|
||||||
ARG RUNTIME_ID=linux-musl-x64
|
ARG RUNTIME_ID=linux-musl-x64
|
||||||
@@ -21,12 +21,13 @@ WORKDIR /source
|
|||||||
|
|
||||||
FROM sdk AS restore
|
FROM sdk AS restore
|
||||||
|
|
||||||
COPY --link Directory.* .globalconfig stylecop.json xunit.runner.json *.sln *.slnx *.config ./
|
COPY --link .editorconfig .globalconfig global.json icon.png nuget.config *.slnx *.sln *.sln.DotSettings stylecop.json testconfig.json xunit.runner.json ./
|
||||||
|
COPY --link --parents ./**Directory*.props ./**Directory.*.targets ./
|
||||||
COPY --link --parents ./**.csproj ./**/packages.lock.json ./
|
COPY --link --parents ./**.csproj ./**/packages.lock.json ./
|
||||||
|
RUN ls -lR .
|
||||||
|
|
||||||
RUN --mount=type=cache,target=/root/.nuget/packages \
|
RUN --mount=type=cache,target=/root/.nuget/packages \
|
||||||
dotnet restore && \
|
dotnet restore
|
||||||
dotnet restore --runtime ${RUNTIME_ID}
|
|
||||||
|
|
||||||
FROM sdk AS gitversion
|
FROM sdk AS gitversion
|
||||||
RUN --mount=type=cache,target=/root/.nuget/packages dotnet tool install --global GitVersion.Tool
|
RUN --mount=type=cache,target=/root/.nuget/packages dotnet tool install --global GitVersion.Tool
|
||||||
@@ -38,6 +39,7 @@ RUN dotnet-gitversion /output json > /version.json
|
|||||||
FROM restore AS build
|
FROM restore AS build
|
||||||
ARG CONFIGURATION
|
ARG CONFIGURATION
|
||||||
|
|
||||||
|
COPY LICENSE.md README.md ./
|
||||||
COPY --link src/ src/
|
COPY --link src/ src/
|
||||||
COPY --link tests/ tests/
|
COPY --link tests/ tests/
|
||||||
COPY --link samples/ samples/
|
COPY --link samples/ samples/
|
||||||
@@ -65,7 +67,8 @@ RUN --mount=type=cache,target=/root/.nuget/packages \
|
|||||||
FROM build AS test
|
FROM build AS test
|
||||||
ARG CONFIGURATION
|
ARG CONFIGURATION
|
||||||
|
|
||||||
RUN dotnet test --no-build --configuration ${CONFIGURATION}
|
RUN --mount=type=cache,target=/root/.nuget/packages \
|
||||||
|
dotnet test --no-build --configuration ${CONFIGURATION}
|
||||||
|
|
||||||
FROM test AS publish
|
FROM test AS publish
|
||||||
ARG CONFIGURATION
|
ARG CONFIGURATION
|
||||||
@@ -74,18 +77,23 @@ ARG RUNTIME_BASE
|
|||||||
ARG PUBLISH_READY_TO_RUN=false
|
ARG PUBLISH_READY_TO_RUN=false
|
||||||
ENV PROJECT=src/${PUBLISHED_PROJECT}/${PUBLISHED_PROJECT}.csproj
|
ENV PROJECT=src/${PUBLISHED_PROJECT}/${PUBLISHED_PROJECT}.csproj
|
||||||
|
|
||||||
|
RUN --mount=type=cache,target=/root/.nuget/packages \
|
||||||
|
dotnet restore --runtime ${RUNTIME_ID} ${PROJECT}
|
||||||
|
|
||||||
RUN --mount=type=cache,target=/root/.nuget/packages \
|
RUN --mount=type=cache,target=/root/.nuget/packages \
|
||||||
. /source/version.env && \
|
. /source/version.env && \
|
||||||
if [ "${RUNTIME_BASE}" = "self-contained" ]; then \
|
if [ "${RUNTIME_BASE}" = "self-contained" ]; then \
|
||||||
eval dotnet publish --configuration ${CONFIGURATION} \
|
eval dotnet publish --configuration ${CONFIGURATION} \
|
||||||
--self-contained --runtime ${RUNTIME_ID} \
|
--self-contained --runtime ${RUNTIME_ID} \
|
||||||
/p:PublishReadyToRun=${PUBLISH_READY_TO_RUN} \
|
/p:PublishReadyToRun=${PUBLISH_READY_TO_RUN} \
|
||||||
|
/p:OpenApiGenerateDocuments=false \
|
||||||
${VERSION_PROPS} \
|
${VERSION_PROPS} \
|
||||||
-o /app/publish ${PROJECT}; \
|
-o /app/publish ${PROJECT}; \
|
||||||
else \
|
else \
|
||||||
eval dotnet publish --configuration ${CONFIGURATION} \
|
eval dotnet publish --configuration ${CONFIGURATION} \
|
||||||
--no-self-contained --runtime ${RUNTIME_ID} \
|
--no-self-contained --runtime ${RUNTIME_ID} \
|
||||||
/p:PublishReadyToRun=${PUBLISH_READY_TO_RUN} \
|
/p:PublishReadyToRun=${PUBLISH_READY_TO_RUN} \
|
||||||
|
/p:OpenApiGenerateDocuments=false \
|
||||||
${VERSION_PROPS} \
|
${VERSION_PROPS} \
|
||||||
-o /app/publish ${PROJECT}; \
|
-o /app/publish ${PROJECT}; \
|
||||||
fi
|
fi
|
||||||
|
|||||||
Reference in New Issue
Block a user