Skip to content

Commit 2e9e966

Browse files
committed
improve targeting for arm64
1 parent 827ddce commit 2e9e966

3 files changed

Lines changed: 46 additions & 17 deletions

File tree

‎.devcontainer/Dockerfile‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ RUN curl -fsSL https://install.julialang.org | sh -s -- --yes --startup-selfupda
3232

3333
ENV PATH="/home/vscode/.juliaup/bin:${PATH}"
3434

35+
ENV JULIA_CPU_TARGET="generic;cortex-a57;thunderx2t99;carmel;apple-m1,clone_all"
36+
3537
# Copy the environment files and workload into the baked-in project.
3638
COPY --chown=vscode:vscode Project.toml Manifest.toml /opt/julia-env/
3739
COPY --chown=vscode:vscode precompile_workload.jl /opt/julia-env/

‎.devcontainer/devcontainer.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "Julia 1.11.9",
3-
"image": "ghcr.io/fncbook/julia-classroom:1.11.9@sha256:86004d91c003917936f591d4b03d933f207f0d150f4b43d964fa2eb683de3f75",
3+
"image": "ghcr.io/fncbook/julia-classroom:1.11.9",
44

55
"remoteEnv": {
66
"PATH": "${containerEnv:PATH}:/home/vscode/.juliaup/bin",

‎.github/workflows/build-docker.yml‎

Lines changed: 43 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,18 @@ env:
1616
JULIA_VERSION: "1.11.9"
1717

1818
jobs:
19-
build-and-push:
20-
runs-on: ubuntu-latest
19+
build:
20+
strategy:
21+
fail-fast: false
22+
matrix:
23+
include:
24+
- platform: linux/amd64
25+
runner: ubuntu-latest
26+
suffix: amd64
27+
- platform: linux/arm64
28+
runner: ubuntu-24.04-arm
29+
suffix: arm64
30+
runs-on: ${{ matrix.runner }}
2131

2232
steps:
2333
- name: Checkout
@@ -30,30 +40,25 @@ jobs:
3040
username: ${{ github.actor }}
3141
password: ${{ secrets.CR_PAT }}
3242

33-
- name: Set up QEMU (for multi-arch builds)
34-
uses: docker/setup-qemu-action@v3
35-
3643
- name: Set up Docker Buildx
3744
uses: docker/setup-buildx-action@v3
3845

39-
- name: Build and push
46+
- name: Build and push (${{ matrix.suffix }})
4047
id: build
4148
uses: docker/build-push-action@v6
4249
with:
4350
context: .
4451
file: .devcontainer/Dockerfile
45-
platforms: linux/amd64,linux/arm64
52+
platforms: ${{ matrix.platform }}
4653
push: true
4754
build-args: JULIA_VERSION=${{ env.JULIA_VERSION }}
48-
tags: |
49-
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.JULIA_VERSION }}
50-
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest
51-
# cache-from: type=registry,ref=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:buildcache
52-
cache-to: type=registry,ref=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:buildcache,mode=max
55+
tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.JULIA_VERSION }}-${{ matrix.suffix }}
56+
cache-from: type=registry,ref=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:buildcache-${{ matrix.suffix }}
57+
cache-to: type=registry,ref=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:buildcache-${{ matrix.suffix }},mode=max
5358

5459
- name: Smoke test — cached packages load without recompiling
5560
run: |
56-
IMAGE="${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}@${{ steps.build.outputs.digest }}"
61+
IMAGE="${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.JULIA_VERSION }}-${{ matrix.suffix }}"
5762
docker pull "$IMAGE"
5863
docker run --rm "$IMAGE" julia -e '
5964
t_plots = @elapsed using Plots
@@ -66,11 +71,33 @@ jobs:
6671
t_ode < 30 || error("using OrdinaryDiffEq too slow ($(t_ode)s) — cache miss?")
6772
'
6873
74+
manifest:
75+
needs: build
76+
runs-on: ubuntu-latest
77+
78+
steps:
79+
- name: Log in to GHCR
80+
uses: docker/login-action@v3
81+
with:
82+
registry: ${{ env.REGISTRY }}
83+
username: ${{ github.actor }}
84+
password: ${{ secrets.CR_PAT }}
85+
86+
- name: Create multi-arch manifest
87+
run: |
88+
for TAG in ${{ env.JULIA_VERSION }} latest; do
89+
docker buildx imagetools create \
90+
--tag ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:$TAG \
91+
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.JULIA_VERSION }}-amd64 \
92+
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.JULIA_VERSION }}-arm64
93+
done
94+
docker buildx imagetools inspect ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.JULIA_VERSION }}
95+
6996
- name: Report image digest
70-
if: always() && steps.build.outputs.digest != ''
7197
run: |
72-
DIGEST='${{ steps.build.outputs.digest }}'
73-
REF="${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.JULIA_VERSION }}@${DIGEST}"
98+
REF_BASE="${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.JULIA_VERSION }}"
99+
DIGEST=$(docker buildx imagetools inspect "$REF_BASE" | awk '/^Digest:/ {print $2; exit}')
100+
REF="${REF_BASE}@${DIGEST}"
74101
echo "::notice title=New image digest::${REF}"
75102
{
76103
echo "## New image pushed"

0 commit comments

Comments
 (0)