Skip to content

Commit

Permalink
Merge c882b3c into 24ccb9c
Browse files Browse the repository at this point in the history
  • Loading branch information
olljanat authored Dec 12, 2021
2 parents 24ccb9c + c882b3c commit 9e5fa9e
Show file tree
Hide file tree
Showing 23 changed files with 255 additions and 20 deletions.
13 changes: 12 additions & 1 deletion samples/aspnetapp/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,13 +1,24 @@
# https://hub.docker.com/_/microsoft-dotnet
FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build
FROM mcr.microsoft.com/dotnet/sdk:6.0 AS restore
WORKDIR /source

# copy csproj and restore as distinct layers
COPY *.sln .
COPY aspnetapp/*.csproj ./aspnetapp/
RUN dotnet restore

# dependencies vulnerability scan
FROM aquasec/trivy AS trivy
COPY --from=restore /source /source
RUN trivy fs \
--exit-code 1 \
--no-progress \
--ignore-unfixed \
--severity "HIGH,CRITICAL" \
--security-checks vuln /source

# copy everything else and build app
FROM restore AS build
COPY aspnetapp/. ./aspnetapp/
WORKDIR /source/aspnetapp
RUN dotnet publish -c release -o /app --no-restore
Expand Down
13 changes: 12 additions & 1 deletion samples/aspnetapp/Dockerfile.alpine-arm64
Original file line number Diff line number Diff line change
@@ -1,13 +1,24 @@
# https://hub.docker.com/_/microsoft-dotnet
FROM mcr.microsoft.com/dotnet/sdk:6.0-alpine AS build
FROM mcr.microsoft.com/dotnet/sdk:6.0-alpine AS restore
WORKDIR /source

# copy csproj and restore as distinct layers
COPY *.sln .
COPY aspnetapp/*.csproj ./aspnetapp/
RUN dotnet restore -r linux-musl-arm64

# dependencies vulnerability scan
FROM aquasec/trivy AS trivy
COPY --from=restore /source /source
RUN trivy fs \
--exit-code 1 \
--no-progress \
--ignore-unfixed \
--severity "HIGH,CRITICAL" \
--security-checks vuln /source

# copy everything else and build app
FROM restore AS build
COPY aspnetapp/. ./aspnetapp/
WORKDIR /source/aspnetapp
RUN dotnet publish -c release -o /app -r linux-musl-arm64 --self-contained false --no-restore
Expand Down
13 changes: 12 additions & 1 deletion samples/aspnetapp/Dockerfile.alpine-x64
Original file line number Diff line number Diff line change
@@ -1,13 +1,24 @@
# https://hub.docker.com/_/microsoft-dotnet
FROM mcr.microsoft.com/dotnet/sdk:6.0-alpine AS build
FROM mcr.microsoft.com/dotnet/sdk:6.0-alpine AS restore
WORKDIR /source

# copy csproj and restore as distinct layers
COPY *.sln .
COPY aspnetapp/*.csproj ./aspnetapp/
RUN dotnet restore -r linux-musl-x64

# dependencies vulnerability scan
FROM aquasec/trivy AS trivy
COPY --from=restore /source /source
RUN trivy fs \
--exit-code 1 \
--no-progress \
--ignore-unfixed \
--severity "HIGH,CRITICAL" \
--security-checks vuln /source

# copy everything else and build app
FROM restore AS build
COPY aspnetapp/. ./aspnetapp/
WORKDIR /source/aspnetapp
RUN dotnet publish -c release -o /app -r linux-musl-x64 --self-contained false --no-restore
Expand Down
13 changes: 12 additions & 1 deletion samples/aspnetapp/Dockerfile.alpine-x64-slim
Original file line number Diff line number Diff line change
@@ -1,13 +1,24 @@
# https://hub.docker.com/_/microsoft-dotnet
FROM mcr.microsoft.com/dotnet/sdk:6.0-alpine AS build
FROM mcr.microsoft.com/dotnet/sdk:6.0-alpine AS restore
WORKDIR /source

# copy csproj and restore as distinct layers
COPY *.sln .
COPY aspnetapp/*.csproj ./aspnetapp/
RUN dotnet restore -r linux-musl-x64 /p:PublishReadyToRun=true

# dependencies vulnerability scan
FROM aquasec/trivy AS trivy
COPY --from=restore /source /source
RUN trivy fs \
--exit-code 1 \
--no-progress \
--ignore-unfixed \
--severity "HIGH,CRITICAL" \
--security-checks vuln /source

# copy everything else and build app
FROM restore AS build
COPY aspnetapp/. ./aspnetapp/
WORKDIR /source/aspnetapp
RUN dotnet publish -c release -o /app -r linux-musl-x64 --self-contained true --no-restore /p:PublishTrimmed=true /p:PublishReadyToRun=true /p:PublishSingleFile=true
Expand Down
13 changes: 12 additions & 1 deletion samples/aspnetapp/Dockerfile.debian-arm64
Original file line number Diff line number Diff line change
@@ -1,13 +1,24 @@
# https://hub.docker.com/_/microsoft-dotnet
FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build
FROM mcr.microsoft.com/dotnet/sdk:6.0 AS restore
WORKDIR /source

# copy csproj and restore as distinct layers
COPY *.sln .
COPY aspnetapp/*.csproj ./aspnetapp/
RUN dotnet restore -r linux-arm64

# dependencies vulnerability scan
FROM aquasec/trivy AS trivy
COPY --from=restore /source /source
RUN trivy fs \
--exit-code 1 \
--no-progress \
--ignore-unfixed \
--severity "HIGH,CRITICAL" \
--security-checks vuln /source

# copy everything else and build app
FROM restore AS build
COPY aspnetapp/. ./aspnetapp/
WORKDIR /source/aspnetapp
RUN dotnet publish -c release -o /app -r linux-arm64 --self-contained false --no-restore
Expand Down
13 changes: 12 additions & 1 deletion samples/aspnetapp/Dockerfile.debian-x64
Original file line number Diff line number Diff line change
@@ -1,13 +1,24 @@
# https://hub.docker.com/_/microsoft-dotnet
FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build
FROM mcr.microsoft.com/dotnet/sdk:6.0 AS restore
WORKDIR /source

# copy csproj and restore as distinct layers
COPY *.sln .
COPY aspnetapp/*.csproj ./aspnetapp/
RUN dotnet restore -r linux-x64

# dependencies vulnerability scan
FROM aquasec/trivy AS trivy
COPY --from=restore /source /source
RUN trivy fs \
--exit-code 1 \
--no-progress \
--ignore-unfixed \
--severity "HIGH,CRITICAL" \
--security-checks vuln /source

# copy everything else and build app
FROM restore AS build
COPY aspnetapp/. ./aspnetapp/
WORKDIR /source/aspnetapp
RUN dotnet publish -c release -o /app -r linux-x64 --self-contained false --no-restore
Expand Down
13 changes: 12 additions & 1 deletion samples/aspnetapp/Dockerfile.debian-x64-slim
Original file line number Diff line number Diff line change
@@ -1,13 +1,24 @@
# https://hub.docker.com/_/microsoft-dotnet
FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build
FROM mcr.microsoft.com/dotnet/sdk:6.0 AS restore
WORKDIR /source

# copy csproj and restore as distinct layers
COPY *.sln .
COPY aspnetapp/*.csproj ./aspnetapp/
RUN dotnet restore -r linux-x64 /p:PublishReadyToRun=true

# dependencies vulnerability scan
FROM aquasec/trivy AS trivy
COPY --from=restore /source /source
RUN trivy fs \
--exit-code 1 \
--no-progress \
--ignore-unfixed \
--severity "HIGH,CRITICAL" \
--security-checks vuln /source

# copy everything else and build app
FROM restore AS build
COPY aspnetapp/. ./aspnetapp/
WORKDIR /source/aspnetapp
RUN dotnet publish -c release -o /app -r linux-x64 --self-contained true --no-restore /p:PublishTrimmed=true /p:PublishReadyToRun=true /p:PublishSingleFile=true
Expand Down
13 changes: 12 additions & 1 deletion samples/aspnetapp/Dockerfile.ubuntu-x64
Original file line number Diff line number Diff line change
@@ -1,13 +1,24 @@
# https://hub.docker.com/_/microsoft-dotnet
FROM mcr.microsoft.com/dotnet/sdk:6.0-focal AS build
FROM mcr.microsoft.com/dotnet/sdk:6.0-focal AS restore
WORKDIR /source

# copy csproj and restore as distinct layers
COPY *.sln .
COPY aspnetapp/*.csproj ./aspnetapp/
RUN dotnet restore -r linux-x64

# dependencies vulnerability scan
FROM aquasec/trivy AS trivy
COPY --from=restore /source /source
RUN trivy fs \
--exit-code 1 \
--no-progress \
--ignore-unfixed \
--severity "HIGH,CRITICAL" \
--security-checks vuln /source

# copy everything else and build app
FROM restore AS build
COPY aspnetapp/. ./aspnetapp/
WORKDIR /source/aspnetapp
RUN dotnet publish -c release -o /app -r linux-x64 --self-contained false --no-restore
Expand Down
13 changes: 12 additions & 1 deletion samples/aspnetapp/Dockerfile.ubuntu-x64-slim
Original file line number Diff line number Diff line change
@@ -1,13 +1,24 @@
# https://hub.docker.com/_/microsoft-dotnet
FROM mcr.microsoft.com/dotnet/sdk:6.0-focal AS build
FROM mcr.microsoft.com/dotnet/sdk:6.0-focal AS restore
WORKDIR /source

# copy csproj and restore as distinct layers
COPY *.sln .
COPY aspnetapp/*.csproj ./aspnetapp/
RUN dotnet restore -r linux-x64 /p:PublishReadyToRun=true

# dependencies vulnerability scan
FROM aquasec/trivy AS trivy
COPY --from=restore /source /source
RUN trivy fs \
--exit-code 1 \
--no-progress \
--ignore-unfixed \
--severity "HIGH,CRITICAL" \
--security-checks vuln /source

# copy everything else and build app
FROM restore AS build
COPY aspnetapp/. ./aspnetapp/
WORKDIR /source/aspnetapp
RUN dotnet publish -c release -o /app -r linux-x64 --self-contained true --no-restore /p:PublishTrimmed=true /p:PublishReadyToRun=true /p:PublishSingleFile=true
Expand Down
5 changes: 5 additions & 0 deletions samples/aspnetapp/aspnetapp/aspnetapp.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<UserSecretsId>57393389627611478466</UserSecretsId>
<RestorePackagesWithLockFile>true</RestorePackagesWithLockFile>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Diagnostics" Version="2.2.0" />
</ItemGroup>

</Project>
13 changes: 12 additions & 1 deletion samples/complexapp/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# https://hub.docker.com/_/microsoft-dotnet
FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build
FROM mcr.microsoft.com/dotnet/sdk:6.0 AS restore
WORKDIR /source

# copy csproj and restore as distinct layers
Expand All @@ -8,7 +8,18 @@ COPY libfoo/*.csproj libfoo/
COPY libbar/*.csproj libbar/
RUN dotnet restore complexapp/complexapp.csproj

# dependencies vulnerability scan
FROM aquasec/trivy AS trivy
COPY --from=restore /source /source
RUN trivy fs \
--exit-code 1 \
--no-progress \
--ignore-unfixed \
--severity "HIGH,CRITICAL" \
--security-checks vuln /source

# copy and build app and libraries
FROM restore AS build
COPY complexapp/ complexapp/
COPY libfoo/ libfoo/
COPY libbar/ libbar/
Expand Down
5 changes: 5 additions & 0 deletions samples/complexapp/complexapp/complexapp.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,16 @@
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<Nullable>enable</Nullable>
<RestorePackagesWithLockFile>true</RestorePackagesWithLockFile>
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\libbar\libbar.csproj" />
<ProjectReference Include="..\libfoo\libfoo.csproj" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="System.Text.Encodings.Web" Version="4.5.0" />
</ItemGroup>

</Project>
13 changes: 12 additions & 1 deletion samples/dotnetapp/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,12 +1,23 @@
# https://hub.docker.com/_/microsoft-dotnet
FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build
FROM mcr.microsoft.com/dotnet/sdk:6.0 AS restore
WORKDIR /source

# copy csproj and restore as distinct layers
COPY *.csproj .
RUN dotnet restore

# dependencies vulnerability scan
FROM aquasec/trivy AS trivy
COPY --from=restore /source /source
RUN trivy fs \
--exit-code 1 \
--no-progress \
--ignore-unfixed \
--severity "HIGH,CRITICAL" \
--security-checks vuln /source

# copy and publish app and libraries
FROM restore AS build
COPY . .
RUN dotnet publish -c release -o /app --no-restore

Expand Down
13 changes: 12 additions & 1 deletion samples/dotnetapp/Dockerfile.alpine-arm64
Original file line number Diff line number Diff line change
@@ -1,12 +1,23 @@
# https://hub.docker.com/_/microsoft-dotnet
FROM mcr.microsoft.com/dotnet/sdk:6.0-alpine AS build
FROM mcr.microsoft.com/dotnet/sdk:6.0-alpine AS restore
WORKDIR /source

# copy csproj and restore as distinct layers
COPY *.csproj .
RUN dotnet restore -r linux-musl-arm64

# dependencies vulnerability scan
FROM aquasec/trivy AS trivy
COPY --from=restore /source /source
RUN trivy fs \
--exit-code 1 \
--no-progress \
--ignore-unfixed \
--severity "HIGH,CRITICAL" \
--security-checks vuln /source

# copy and publish app and libraries
FROM restore AS build
COPY . .
RUN dotnet publish -c release -o /app -r linux-musl-arm64 --self-contained false --no-restore

Expand Down
13 changes: 12 additions & 1 deletion samples/dotnetapp/Dockerfile.alpine-x64
Original file line number Diff line number Diff line change
@@ -1,12 +1,23 @@
# https://hub.docker.com/_/microsoft-dotnet
FROM mcr.microsoft.com/dotnet/sdk:6.0-alpine AS build
FROM mcr.microsoft.com/dotnet/sdk:6.0-alpine AS restore
WORKDIR /source

# copy csproj and restore as distinct layers
COPY *.csproj .
RUN dotnet restore -r linux-musl-x64

# dependencies vulnerability scan
FROM aquasec/trivy AS trivy
COPY --from=restore /source /source
RUN trivy fs \
--exit-code 1 \
--no-progress \
--ignore-unfixed \
--severity "HIGH,CRITICAL" \
--security-checks vuln /source

# copy and publish app and libraries
FROM restore AS build
COPY . .
RUN dotnet publish -c release -o /app -r linux-musl-x64 --self-contained false --no-restore

Expand Down
13 changes: 12 additions & 1 deletion samples/dotnetapp/Dockerfile.alpine-x64-slim
Original file line number Diff line number Diff line change
@@ -1,12 +1,23 @@
# https://hub.docker.com/_/microsoft-dotnet
FROM mcr.microsoft.com/dotnet/sdk:6.0-alpine AS build
FROM mcr.microsoft.com/dotnet/sdk:6.0-alpine AS restore
WORKDIR /source

# copy csproj and restore as distinct layers
COPY *.csproj .
RUN dotnet restore -r linux-musl-x64 /p:PublishReadyToRun=true

# dependencies vulnerability scan
FROM aquasec/trivy AS trivy
COPY --from=restore /source /source
RUN trivy fs \
--exit-code 1 \
--no-progress \
--ignore-unfixed \
--severity "HIGH,CRITICAL" \
--security-checks vuln /source

# copy and publish app and libraries
FROM restore AS build
COPY . .
RUN dotnet publish -c release -o /app -r linux-musl-x64 --self-contained true --no-restore /p:PublishTrimmed=true /p:PublishReadyToRun=true /p:PublishSingleFile=true

Expand Down
Loading

0 comments on commit 9e5fa9e

Please sign in to comment.