Skip to content

Commit 864f4ed

Browse files
committed
build for Linux ARM64 in CI
1 parent 93c5db7 commit 864f4ed

File tree

3 files changed

+21
-5
lines changed

3 files changed

+21
-5
lines changed

.github/workflows/publish.yml

+13-1
Original file line numberDiff line numberDiff line change
@@ -143,10 +143,20 @@ jobs:
143143
- file: Dockerfile.al2
144144
platform: linux
145145
architecture: x64
146+
runner: ubuntu-24.04
147+
- file: Dockerfile.al2
148+
platform: linux
149+
architecture: arm64
150+
runner: ubuntu-24.04-arm
146151
- file: Dockerfile.alpine
147152
platform: linux.alpine
148153
architecture: x64
149-
runs-on: ubuntu-latest
154+
runner: ubuntu-24.04
155+
- file: Dockerfile.alpine
156+
platform: linux.alpine
157+
architecture: arm64
158+
runner: ubuntu-24.04-arm
159+
runs-on: ${{ matrix.runner }}
150160
timeout-minutes: 10
151161
steps:
152162
- name: checkout
@@ -158,10 +168,12 @@ jobs:
158168
shell: pwsh
159169
env:
160170
DOCKERFILE: ${{ matrix.file }}
171+
ARCHITECTURE: ${{ matrix.architecture }}
161172
Version: ${{ needs.create_release.outputs.version }}
162173
run: |
163174
docker buildx build `
164175
-f $env:DOCKERFILE `
176+
--build-arg arch=$env:ARCHITECTURE `
165177
--build-arg version=$env:Version `
166178
-o build .
167179

Dockerfile.al2

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
FROM public.ecr.aws/amazonlinux/amazonlinux:2 AS build
22

3+
ARG arch="x64"
4+
35
ARG version=""
46
ENV Version=${version}
57

@@ -17,12 +19,12 @@ WORKDIR /source
1719
# Make configs & dependencies a separate layer to improve caching & build time on code change.
1820
COPY Directory.Build.props Directory.Build.props
1921
COPY src/D2L.Bmx/D2L.Bmx.csproj src/D2L.Bmx/D2L.Bmx.csproj
20-
RUN dotnet restore src/D2L.Bmx -r linux-x64
22+
RUN dotnet restore src/D2L.Bmx -r linux-${arch}
2123

2224
COPY . .
2325
RUN dotnet publish src/D2L.Bmx \
2426
--no-restore \
25-
-r linux-x64 \
27+
-r linux-${arch} \
2628
-o app
2729

2830
FROM scratch as export

Dockerfile.alpine

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
FROM amd64/alpine:3.15 AS build
22

3+
ARG arch="x64"
4+
35
ARG version=""
46
ENV Version=${version}
57

@@ -18,12 +20,12 @@ WORKDIR /source
1820
# Make configs & dependencies a separate layer to improve caching & build time on code change.
1921
COPY Directory.Build.props Directory.Build.props
2022
COPY src/D2L.Bmx/D2L.Bmx.csproj src/D2L.Bmx/D2L.Bmx.csproj
21-
RUN dotnet restore src/D2L.Bmx -r linux-musl-x64
23+
RUN dotnet restore src/D2L.Bmx -r linux-musl-${arch}
2224

2325
COPY . .
2426
RUN dotnet publish src/D2L.Bmx \
2527
--no-restore \
26-
-r linux-musl-x64 \
28+
-r linux-musl-${arch} \
2729
-o app
2830

2931
FROM scratch as export

0 commit comments

Comments
 (0)