Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: upgrade to .NET 6 and use docker image that supports both ARM and Intel CPU architectures #48

Merged
merged 2 commits into from
Nov 11, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
feat: upgrade to .NET 6 and use docker image that supports both ARM a…
…nd Intel CPU architectures
  • Loading branch information
bsterne committed Nov 11, 2021
commit 9c5218ee13c85a5489dd94af0186aecaf7057186
2 changes: 1 addition & 1 deletion .github/workflows/pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
- name: Setup .NET
uses: actions/setup-dotnet@v1
with:
dotnet-version: 5.0.x
dotnet-version: 6.0.x

- name: Verify
run: make verify
2 changes: 1 addition & 1 deletion .github/workflows/verify.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
- name: Setup .NET
uses: actions/setup-dotnet@v1
with:
dotnet-version: 5.0.x
dotnet-version: 6.0.x

- name: Setup Node
uses: actions/setup-node@v2
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net5.0</TargetFramework>
<TargetFramework>net6.0</TargetFramework>

<IsPackable>false</IsPackable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Azure.Security.KeyVault.Keys" Version="4.2.0" />
<PackageReference Include="Azure.Security.KeyVault.Secrets" Version="4.2.0" />
<PackageReference Include="Microsoft.IdentityModel.Tokens" Version="6.14.0" />
<PackageReference Include="Microsoft.IdentityModel.Tokens" Version="6.14.1" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.0.0" />
<PackageReference Include="xunit" Version="2.4.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.3">
Expand Down
12 changes: 10 additions & 2 deletions AzureKeyVaultEmulator.sln
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,9 @@ EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Scripts", "Scripts", "{EEEEDF54-ADE9-447E-8ED7-36A9E3CC0FD0}"
ProjectSection(SolutionItems) = preProject
scripts\acceptancetest.sh = scripts\acceptancetest.sh
scripts\build.sh = scripts\build.sh
scripts\dependencycheck.sh = scripts\dependencycheck.sh
scripts\serviceup.sh = scripts\serviceup.sh
scripts\startdocker.sh = scripts\startdocker.sh
scripts\startlocal.sh = scripts\startlocal.sh
scripts\stopdocker.sh = scripts\stopdocker.sh
scripts\stopservice.sh = scripts\stopservice.sh
scripts\verify.sh = scripts\verify.sh
Expand All @@ -46,6 +44,13 @@ ProjectSection(SolutionItems) = preProject
.github\PULL_REQUEST_TEMPLATE.md = .github\PULL_REQUEST_TEMPLATE.md
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Checks", "Checks", "{9D107928-7669-4B0C-9291-F5318F9F334B}"
ProjectSection(SolutionItems) = preProject
scripts\checks\dockercheck.sh = scripts\checks\dockercheck.sh
scripts\checks\dockercomposecheck.sh = scripts\checks\dockercomposecheck.sh
scripts\checks\dotnetcheck.sh = scripts\checks\dotnetcheck.sh
EndProjectSection
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand All @@ -61,4 +66,7 @@ Global
{181CD468-BBCA-424A-97A7-5ACC8331FE5A}.Release|Any CPU.ActiveCfg = Release|Any CPU
{181CD468-BBCA-424A-97A7-5ACC8331FE5A}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{9D107928-7669-4B0C-9291-F5318F9F334B} = {EEEEDF54-ADE9-447E-8ED7-36A9E3CC0FD0}
EndGlobalSection
EndGlobal
4 changes: 2 additions & 2 deletions AzureKeyVaultEmulator/AzureKeyVaultEmulator.csproj
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFramework>net5.0</TargetFramework>
<TargetFramework>net6.0</TargetFramework>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="5.0.11" />
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="6.0.0" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.2.3" />
</ItemGroup>
Expand Down
7 changes: 3 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM mcr.microsoft.com/dotnet/sdk:5.0-alpine AS builder
FROM mcr.microsoft.com/dotnet/sdk:6.0-alpine AS builder
WORKDIR /app

COPY *.sln .
Expand All @@ -8,12 +8,11 @@ RUN for file in $(ls *.csproj); do mkdir -p ./${file%.*}/ && mv $file ./${file%.
RUN dotnet restore

COPY . .
RUN dotnet build AzureKeyVaultEmulator.sln --no-restore -c Release
RUN dotnet publish AzureKeyVaultEmulator/AzureKeyVaultEmulator.csproj -c Release -o publish --no-restore --no-build
RUN dotnet publish AzureKeyVaultEmulator/AzureKeyVaultEmulator.csproj -c Release -o publish --no-restore

########################################

FROM mcr.microsoft.com/dotnet/aspnet:5.0-alpine
FROM mcr.microsoft.com/dotnet/aspnet:6.0-alpine
WORKDIR /app

RUN apk add --no-cache icu-libs tzdata
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ For the Azure KeyVault Emulator to be accessible from other containers in the sa
1. Add a service to docker-compose.yml for Azure KeyVault Emulator:

```
version: '3.7'
version: '3.9'

services:
...
Expand All @@ -94,7 +94,7 @@ For the Azure KeyVault Emulator to be accessible from other containers in the sa
1. Modify the client application's entrypoint to add the self-signed certificate to the truststore. Example using docker-compose.yml to override the entrypoint:

```
version: '3.7'
version: '3.9'

services:
my-awesome-keyvault-client:
Expand All @@ -117,7 +117,7 @@ The provided scripts will check for all dependencies, start docker, build the so
### Dependencies
- [Docker](https://www.docker.com/products/docker-desktop)
- [Docker Compose](https://www.docker.com/products/docker-desktop)
- [.NET 5](https://dotnet.microsoft.com/download/dotnet/5.0)
- [.NET 6](https://dotnet.microsoft.com/download/dotnet/6.0)

### Build the KeyVault emulator and run Tests

Expand Down
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version: '3.7'
version: '3.9'

services:
key-vault-emulator:
Expand Down
6 changes: 0 additions & 6 deletions makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,6 @@ MAKEFLAGS += --silent
verify:
docker-compose pull && ./scripts/verify.sh

start-local:
docker-compose pull && ./scripts/startlocal.sh

build:
./scripts/build.sh

acceptance-test:
./scripts/acceptancetest.sh

Expand Down
2 changes: 2 additions & 0 deletions scripts/acceptancetest.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ cd $(dirname $0)/..

echo "Running acceptance tests..."

dotnet restore -v=quiet
dotnet build AzureKeyVaultEmulator.AcceptanceTests/AzureKeyVaultEmulator.AcceptanceTests.csproj --no-restore -c Release -v=minimal
dotnet test AzureKeyVaultEmulator.AcceptanceTests/AzureKeyVaultEmulator.AcceptanceTests.csproj --no-restore --no-build -c Release -v=normal

result=$?
Expand Down
16 changes: 0 additions & 16 deletions scripts/build.sh

This file was deleted.

6 changes: 3 additions & 3 deletions scripts/checks/dotnetcheck.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#!/bin/bash

echo "Checking .NET..."
EXPECTED_DOTNET="5.0.x"
EXPECTED_DOTNET_REGEX="5\.0\.([0-9]*)"
EXPECTED_DOTNET="6.0.x"
EXPECTED_DOTNET_REGEX="6\.0\.([0-9]*)"

while IFS= read -r line
do
Expand All @@ -13,5 +13,5 @@ do
fi
done <<<"$(dotnet --list-sdks)"

echo "Please Install .NET $EXPECTED_DOTNET SDK from here: https://dotnet.microsoft.com/download/dotnet/5.0"
echo "Please Install .NET $EXPECTED_DOTNET SDK from here: https://dotnet.microsoft.com/download/dotnet/6.0"
exit 1
8 changes: 6 additions & 2 deletions scripts/importcert.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,13 @@ current_directory="$PWD"
cd $(dirname $0)/..

if [ "$(uname)" == "Darwin" ]; then
sudo security add-trusted-cert -d -r trustRoot -k /Library/Keychains/System.keychain local-certs/azure-key-vault-emulator.crt
if ! security find-certificate -c azure-key-vault-emulator > /dev/null; then
sudo security add-trusted-cert -d -r trustRoot -k /Library/Keychains/System.keychain local-certs/azure-key-vault-emulator.crt
else
echo "azure-key-vault-emulator certificate already installed"
fi
elif [ "$(expr substr $(uname -s) 1 5)" == "Linux" ]; then
sudo cp local-certs/azure-key-vault-emulator.crt /usr/local/share/ca-certificates/azure-key-vault-emulator.crt
sudo cp local-certs/azure-key-vault-emulator.crt /Library/Keychains/System.keychain local-certs/azure-key-vault-emulator.crt
sudo update-ca-certificates
fi

Expand Down
18 changes: 0 additions & 18 deletions scripts/startlocal.sh

This file was deleted.

1 change: 0 additions & 1 deletion scripts/verify.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ time {
./dependencycheck.sh
./importcert.sh
./stopdocker.sh
./build.sh
./startdocker.sh
./serviceup.sh
./acceptancetest.sh
Expand Down