Skip to content

Commit 75e4ea1

Browse files
authored
Ensure we use buildx for cross-platform docker builds (#236)
* ensure we use buildx for cross-platform docker builds * update Ubuntu build image * missed image ref * enable more docker platforms * specify exact image to use * Update setup.sh * Update setup.sh
1 parent c5ca836 commit 75e4ea1

File tree

3 files changed

+12
-6
lines changed

3 files changed

+12
-6
lines changed

Build.Docker.ps1

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,10 @@ $IsPublishedBuild = ($env:APPVEYOR_REPO_BRANCH -eq "main" -or $env:APPVEYOR_REPO
44
$version = @{ $true = $env:APPVEYOR_BUILD_VERSION; $false = "99.99.99" }[$env:APPVEYOR_BUILD_VERSION -ne $NULL];
55
$framework = "net6.0"
66
$image = "datalust/seqcli"
7-
$archs = @("x64", "arm64")
7+
$archs = @(
8+
@{ rid = "x64"; platform = "linux/amd64" },
9+
@{ rid = "arm64"; platform = "linux/arm/v8" }
10+
)
811

912
function Execute-Tests
1013
{
@@ -24,11 +27,11 @@ function Execute-Tests
2427

2528
function Build-DockerImage($arch)
2629
{
27-
$rid = "linux-$arch"
30+
$rid = "linux-$($arch.rid)"
2831
& dotnet publish src/SeqCli/SeqCli.csproj -c Release -f $framework -r $rid --self-contained /p:VersionPrefix=$version
2932
if($LASTEXITCODE -ne 0) { exit 2 }
3033

31-
& docker build -f dockerfiles/seqcli/$rid.Dockerfile -t "$image-ci:$version-$arch" .
34+
& docker buildx build --platform "$($arch.platform)" -f dockerfiles/seqcli/$rid.Dockerfile -t "$image-ci:$version-$($arch.rid)" .
3235
if($LASTEXITCODE -ne 0) { exit 3 }
3336
}
3437

@@ -41,7 +44,7 @@ function Publish-DockerImage($arch)
4144
if ($LASTEXITCODE) { exit 3 }
4245
}
4346

44-
& docker push "$image-ci:$version-$arch"
47+
& docker push "$image-ci:$version-$($arch.rid)"
4548
if($LASTEXITCODE -ne 0) { exit 3 }
4649

4750
$ErrorActionPreference = "Stop"

appveyor.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ version: 2022.1.{build}
22
skip_tags: true
33
image:
44
- Visual Studio 2022
5-
- Ubuntu1804
5+
- Ubuntu2004
66
environment:
77
DOCKER_TOKEN:
88
secure: QKr2YEuliXdFKe3jN7w97w==
@@ -47,7 +47,7 @@ for:
4747
-
4848
matrix:
4949
only:
50-
- image: Ubuntu1804
50+
- image: Ubuntu2004
5151

5252
install:
5353
- pwsh: ./setup.sh

setup.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,6 @@ curl https://dot.net/v1/dotnet-install.sh -sSfL --output dotnet-install.sh
1313
chmod +x dotnet-install.sh
1414
./dotnet-install.sh --install-dir $HOME/.dotnetcli --no-path --version $RequiredDotnetVersion
1515
rm dotnet-install.sh
16+
17+
docker run --privileged --rm docker/binfmt:a7996909642ee92942dcd6cff44b9b95f08dad64
18+
sudo service docker restart

0 commit comments

Comments
 (0)