Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
warning-explosive committed Feb 8, 2023
1 parent d9d442a commit 7eede7f
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 15 deletions.
16 changes: 9 additions & 7 deletions Dockerfile.webtest
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,18 @@ ARG SDK_ARCH=arm64v8
ARG DOT_NET_VERSION=7.0

FROM mcr.microsoft.com/dotnet/sdk:${DOT_NET_VERSION}-alpine-${SDK_ARCH} AS builder
# TARGETARCH = arm64 | x64 | amd64
ARG TARGETARCH
RUN arch=$TARGETARCH \
&& if [ "$TARGETARCH" = "amd64" ]; then arch="x64"; fi \
&& echo $arch > /tmp/arch
ENV NUGET_XMLDOC_MODE=none
WORKDIR /build

# separate restore layer
COPY ["./*.csproj", "./*/*.csproj", "./*/*/*.csproj", "./*.sln", "./*.sh", "./NuGet.config", "./"]
RUN chmod +x restore_project_structure.sh
RUN ./restore_project_structure.sh
RUN dotnet restore Tests/Test.WebApplication/Test.WebApplication.csproj --packages ./packages --no-cache -v:minimal

# separate build layer
COPY . .
RUN dotnet restore Tests/Test.WebApplication/Test.WebApplication.csproj -r linux-$(cat /tmp/arch) --no-cache -v:minimal
RUN dotnet build Tests/Test.WebApplication/Test.WebApplication.csproj -c Debug -o out -r linux-$(cat /tmp/arch) --no-self-contained --no-cache --no-restore -v:minimal
RUN dotnet build Tests/Test.WebApplication/Test.WebApplication.csproj -c Debug -o out --packages ./packages --no-cache -v:minimal

FROM mcr.microsoft.com/dotnet/aspnet:${DOT_NET_VERSION}-alpine
WORKDIR /app
Expand Down
8 changes: 0 additions & 8 deletions Tests/Test.WebApplication/Test.WebApplication.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,6 @@
</PackageReference>
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.4.0" />
<PackageReference Include="Swashbuckle.AspNetCore.Newtonsoft" Version="6.4.0" />
<PackageReference Include="System.Collections" Version="4.3.0" />
<PackageReference Include="System.Diagnostics.Debug" Version="4.3.0" />
<PackageReference Include="System.IO" Version="4.3.0" />
<PackageReference Include="System.IO.FileSystem.Primitives" Version="4.3.0" />
<PackageReference Include="System.Runtime.Extensions" Version="4.3.0" />
<PackageReference Include="System.Runtime.Handles" Version="4.3.0" />
<PackageReference Include="System.Runtime.InteropServices" Version="4.3.0" />
<PackageReference Include="System.Threading.Tasks" Version="4.3.0" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\Endpoints\AuthEndpoint.Host\AuthEndpoint.Host.csproj" />
Expand Down
8 changes: 8 additions & 0 deletions restore_project_structure.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/bin/sh
for file in $(find . -name '*.csproj' -exec basename {} \;)
do
dest=$(egrep -o ", \"(.*${file})" Core.sln | cut -d \" -f 2)
dest=${dest//\\//}
mkdir -p `dirname ${dest}`
mv "${file}" "${dest}"
done

0 comments on commit 7eede7f

Please sign in to comment.