Skip to content

Commit 8725fa4

Browse files
Add support for 'linux/arm64' platforms (#7094)
Co-authored-by: Justin Clift <[email protected]>
1 parent ea0b3cb commit 8725fa4

File tree

2 files changed

+19
-7
lines changed

2 files changed

+19
-7
lines changed

.github/workflows/preview-image.yml

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,10 @@ jobs:
4444
node-version: ${{ env.NODE_VERSION }}
4545
cache: 'yarn'
4646

47-
- name: Install Dependencies
48-
run: |
49-
npm install --global --force [email protected]
50-
yarn cache clean && yarn --frozen-lockfile --network-concurrency 1
47+
- name: Set up QEMU
48+
uses: docker/setup-qemu-action@v3
49+
with:
50+
platforms: arm64
5151

5252
- name: Set up Docker Buildx
5353
uses: docker/setup-buildx-action@v3
@@ -58,6 +58,11 @@ jobs:
5858
username: ${{ vars.DOCKER_USER }}
5959
password: ${{ secrets.DOCKER_PASS }}
6060

61+
- name: Install Dependencies
62+
run: |
63+
npm install --global --force [email protected]
64+
yarn cache clean && yarn --frozen-lockfile --network-concurrency 1
65+
6166
- name: Set version
6267
id: version
6368
run: |
@@ -66,6 +71,7 @@ jobs:
6671
VERSION_TAG=$(jq -r .version package.json)
6772
echo "VERSION_TAG=$VERSION_TAG" >> "$GITHUB_OUTPUT"
6873
74+
# TODO: We can use GitHub Actions's matrix option to reduce the build time.
6975
- name: Build and push preview image to Docker Hub
7076
uses: docker/build-push-action@v4
7177
with:
@@ -76,9 +82,9 @@ jobs:
7682
context: .
7783
build-args: |
7884
test_all_deps=true
79-
cache-from: type=gha
80-
cache-to: type=gha,mode=max
81-
platforms: linux/amd64
85+
cache-from: type=gha,scope=multi-platform
86+
cache-to: type=gha,mode=max,scope=multi-platform
87+
platforms: linux/amd64,linux/arm64
8288
env:
8389
DOCKER_CONTENT_TRUST: true
8490

Dockerfile

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@ COPY --chown=redash scripts /frontend/scripts
2020
ARG code_coverage
2121
ENV BABEL_ENV=${code_coverage:+test}
2222

23+
# Avoid issues caused by lags in disk and network I/O speeds when working on top of QEMU emulation for multi-platform image building.
24+
RUN yarn config set network-timeout 300000
25+
2326
RUN if [ "x$skip_frontend_build" = "x" ] ; then yarn --frozen-lockfile --network-concurrency 1; fi
2427

2528
COPY --chown=redash client /frontend/client
@@ -86,6 +89,9 @@ ENV POETRY_HOME=/etc/poetry
8689
ENV POETRY_VIRTUALENVS_CREATE=false
8790
RUN curl -sSL https://install.python-poetry.org | python3 -
8891

92+
# Avoid crashes, including corrupted cache artifacts, when building multi-platform images with GitHub Actions.
93+
RUN /etc/poetry/bin/poetry cache clear pypi --all
94+
8995
COPY pyproject.toml poetry.lock ./
9096

9197
ARG POETRY_OPTIONS="--no-root --no-interaction --no-ansi"

0 commit comments

Comments
 (0)