Skip to content

Commit 38eca18

Browse files
author
Sarah Laplante
authored
Merge pull request OutlineFoundation#1700 from oceanapplications/master
chore(server): port shadowbox Docker image to arm64
2 parents 326b527 + 847d66f commit 38eca18

3 files changed

Lines changed: 57 additions & 5 deletions

File tree

.github/workflows/build_and_test_debug.yml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,16 @@ jobs:
4343
node-version: 18
4444
cache: npm
4545

46+
- name: Install Go
47+
uses: actions/setup-go@v5
48+
with:
49+
go-version-file: go.mod
50+
cache: false
51+
4652
- name: Install NPM Dependencies
4753
run: npm ci
54+
env:
55+
PUPPETEER_SKIP_CHROMIUM_DOWNLOAD: 'true'
4856

4957
- name: Lint
5058
run: ./task lint
@@ -81,6 +89,40 @@ jobs:
8189
files: |
8290
src/shadowbox/server/api.yml
8391
92+
shadowbox-arm64:
93+
name: Shadowbox (arm64)
94+
runs-on: ubuntu-22.04-arm
95+
needs: lint
96+
steps:
97+
- name: Checkout
98+
uses: actions/checkout@v2.3.4
99+
100+
- name: Install Node
101+
uses: actions/setup-node@v3
102+
with:
103+
node-version: 18
104+
cache: npm
105+
106+
- name: Install Go
107+
uses: actions/setup-go@v5
108+
with:
109+
go-version-file: go.mod
110+
cache: false
111+
112+
- name: Install NPM Dependencies
113+
run: npm ci
114+
env:
115+
PUPPETEER_SKIP_CHROMIUM_DOWNLOAD: 'true'
116+
117+
- name: Shadowbox Debug Build (arm64)
118+
run: TARGET_ARCH=aarch64 ./task shadowbox:build
119+
120+
- name: Shadowbox Unit Test
121+
run: ./task shadowbox:test
122+
123+
- name: Shadowbox Docker Build (arm64)
124+
run: TARGET_ARCH=aarch64 ./task shadowbox:docker:build
125+
84126
manual-install-script:
85127
name: Manual Install Script
86128
runs-on: ubuntu-latest

src/server_manager/install_scripts/install_server.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -456,8 +456,8 @@ function set_hostname() {
456456
install_shadowbox() {
457457
local MACHINE_TYPE
458458
MACHINE_TYPE="$(uname -m)"
459-
if [[ "${MACHINE_TYPE}" != "x86_64" ]]; then
460-
log_error "Unsupported machine type: ${MACHINE_TYPE}. Please run this script on a x86_64 machine"
459+
if [[ "${MACHINE_TYPE}" != "x86_64" && "${MACHINE_TYPE}" != "aarch64" && "${MACHINE_TYPE}" != "arm64" ]]; then
460+
log_error "Unsupported machine type: ${MACHINE_TYPE}. Supported architectures: x86_64, aarch64/arm64."
461461
exit 1
462462
fi
463463

src/shadowbox/Taskfile.yml

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ tasks:
2323
vars:
2424
TARGET_OS: '{{.TARGET_OS | default "linux"}}'
2525
TARGET_ARCH: '{{.TARGET_ARCH | default "x86_64"}}'
26-
GOARCH: '{{get (dict "x86_64" "amd64") .TARGET_ARCH | default .TARGET_ARCH}}'
26+
GOARCH: '{{get (dict "x86_64" "amd64" "aarch64" "arm64") .TARGET_ARCH | default .TARGET_ARCH}}'
2727
TARGET_DIR: '{{.TARGET_DIR | default (joinPath .OUTPUT_BASE .TARGET_OS .TARGET_ARCH)}}'
2828
NODE_DIR: '{{joinPath .TARGET_DIR "app"}}'
2929
BIN_DIR: '{{joinPath .TARGET_DIR "bin"}}'
@@ -79,10 +79,19 @@ tasks:
7979
# Newer node images have no valid content trust data.
8080
# Pin the image node:16.18.0-alpine3.16 by hash.
8181
# See image at https://hub.docker.com/_/node/tags?page=1&name=18.18.0-alpine3.18
82+
# Note: "aarch64" is an alias for "arm64" — Linux ARM64 hosts report "aarch64" via uname -m.
8283
NODE_IMAGE: '{{get
8384
(dict
84-
"x86_64" "node@sha256:a0b787b0d53feacfa6d606fb555e0dbfebab30573277f1fe25148b05b66fa097"
85-
"arm64" "node@sha256:b4b7a1dd149c65ee6025956ac065a843b4409a62068bd2b0cbafbb30ca2fab3b"
85+
"x86_64" "node@sha256:a0b787b0d53feacfa6d606fb555e0dbfebab30573277f1fe25148b05b66fa097"
86+
"arm64" "node@sha256:b4b7a1dd149c65ee6025956ac065a843b4409a62068bd2b0cbafbb30ca2fab3b"
87+
"aarch64" "node@sha256:b4b7a1dd149c65ee6025956ac065a843b4409a62068bd2b0cbafbb30ca2fab3b"
88+
) .TARGET_ARCH
89+
}}'
90+
DOCKER_PLATFORM: '{{get
91+
(dict
92+
"x86_64" "linux/amd64"
93+
"arm64" "linux/arm64"
94+
"aarch64" "linux/arm64"
8695
) .TARGET_ARCH
8796
}}'
8897
env:
@@ -103,6 +112,7 @@ tasks:
103112
# Build image with given root
104113
- |
105114
"${DOCKER:-docker}" build --force-rm \
115+
--platform '{{.DOCKER_PLATFORM}}' \
106116
--build-arg NODE_IMAGE='{{.NODE_IMAGE}}' \
107117
--build-arg VERSION='{{.VERSION}}' \
108118
-f '{{joinPath .TASKFILE_DIR "docker" "Dockerfile"}}' \

0 commit comments

Comments
 (0)