Skip to content

Commit b272662

Browse files
committed
Fix docker build OOMing in CI for arm64 builds
Yoinked from synapse: - matrix-org/synapse#14173 - matrix-org/synapse@424d1d2
1 parent 5298eb9 commit b272662

File tree

3 files changed

+16
-1
lines changed

3 files changed

+16
-1
lines changed

.github/workflows/docker-hub-latest.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,4 +34,9 @@ jobs:
3434
platforms: ${{ env.PLATFORMS }}
3535
push: ${{ env.PUSH }}
3636
tags: |
37-
${{ env.DOCKER_NAMESPACE }}/matrix-hookshot:latest
37+
${{ env.DOCKER_NAMESPACE }}/matrix-hookshot:latest
38+
39+
# arm64 builds OOM without the git fetch setting. c.f.
40+
# https://github.com/rust-lang/cargo/issues/10583
41+
build-args: |
42+
CARGO_NET_GIT_FETCH_WITH_CLI=true

.github/workflows/docker-hub-release.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,3 +36,8 @@ jobs:
3636
push: true
3737
tags: |
3838
${{ env.DOCKER_NAMESPACE }}/matrix-hookshot:${{ env.RELEASE_VERSION }}
39+
40+
# arm64 builds OOM without the git fetch setting. c.f.
41+
# https://github.com/rust-lang/cargo/issues/10583
42+
build-args: |
43+
CARGO_NET_GIT_FETCH_WITH_CLI=true

Dockerfile

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,11 @@ FROM node:16 AS builder
77
RUN curl https://sh.rustup.rs -sSf | sh -s -- -y --profile minimal
88
ENV PATH="/root/.cargo/bin:${PATH}"
99

10+
# arm64 builds consume a lot of memory if `CARGO_NET_GIT_FETCH_WITH_CLI` is not
11+
# set to true, so we expose it as a build-arg.
12+
ARG CARGO_NET_GIT_FETCH_WITH_CLI=false
13+
ENV CARGO_NET_GIT_FETCH_WITH_CLI=$CARGO_NET_GIT_FETCH_WITH_CLI
14+
1015
# Needed to build rust things for matrix-sdk-crypto-nodejs
1116
# See https://github.com/matrix-org/matrix-rust-sdk-bindings/blob/main/crates/matrix-sdk-crypto-nodejs/release/Dockerfile.linux#L5-L6
1217
RUN apt-get update && apt-get install -y build-essential cmake time

0 commit comments

Comments
 (0)