Skip to content

Commit 6b091fc

Browse files
authored
Merge pull request #749 from wb7:main
Adapt build script to aarch64 platform (v2)
2 parents ca0047e + 5450506 commit 6b091fc

File tree

2 files changed

+39
-11
lines changed

2 files changed

+39
-11
lines changed

build.sh

+37-10
Original file line numberDiff line numberDiff line change
@@ -10,26 +10,53 @@ export BUILD_ROLLING="${1:-no}"
1010

1111
DOCKER=docker
1212

13+
# The following variables can be overridden using env-variables
14+
15+
# Set tag namespace (i.e. ghcr.io/<org> for github package registry)
16+
TAG_NS="${TAG_NS:-maxking}"
17+
# Set default platforms to build
18+
BUILD_PLATFORM="${BUILD_PLATFORM:-linux/arm64/v8,linux/amd64}"
19+
# Platform to load into docker after build
20+
# Can only load one platform, should match host
21+
# mostly used: linux/amd64 and linux/arm64
22+
CURRENT_PLATFORM="${CURRENT_PLATFORM:-linux/amd64}"
23+
# set env-var PUSH to yes to push to registry
24+
PUSH="${PUSH:-no}"
25+
26+
build() {
27+
if [ "$PUSH" = "yes" ]; then
28+
$DOCKER buildx build --platform $BUILD_PLATFORM $@ --push
29+
else
30+
$DOCKER buildx build --platform $BUILD_PLATFORM $@
31+
fi
32+
$DOCKER buildx build --platform $CURRENT_PLATFORM $@ --load
33+
}
34+
35+
# Check if the builder with name "multiarch" exists, if not create it
36+
if ! docker buildx ls | grep -q multiarch; then
37+
docker buildx create --name multiarch --driver docker-container --use
38+
fi
39+
1340
if [ "$BUILD_ROLLING" = "yes" ]; then
1441
echo "Building rolling releases..."
1542
# Build the mailman-core image.
16-
$DOCKER build -f core/Dockerfile.dev \
43+
build -f core/Dockerfile.dev \
1744
--label version.git_commit="$COMMIT_ID" \
18-
-t maxking/mailman-core:rolling core/
45+
-t $TAG_NS/mailman-core:rolling core/
1946

2047
# Build the mailman-web image.
21-
$DOCKER build -f web/Dockerfile.dev \
48+
build -f web/Dockerfile.dev \
2249
--label version.git_commit="$COMMIT_ID" \
23-
-t maxking/mailman-web:rolling web/
50+
-t $TAG_NS/mailman-web:rolling web/
2451

2552
# build the postorius image.
26-
$DOCKER build -f postorius/Dockerfile.dev\
27-
--label version.git_commit="$COMMIT_ID"\
28-
-t maxking/postorius:rolling postorius/
53+
build -f postorius/Dockerfile.dev\
54+
--label version.git_commit="$COMMIT_ID"\
55+
-t $TAG_NS/postorius:rolling postorius/
2956
else
3057
echo "Building stable releases..."
3158
# Build the stable releases.
32-
$DOCKER build -t maxking/mailman-core:rolling core/
33-
$DOCKER build -t maxking/mailman-web:rolling web/
34-
$DOCKER build -t maxking/postorius:rolling postorius/
59+
build --tag $TAG_NS/mailman-core:rolling core/
60+
build --tag $TAG_NS/mailman-web:rolling web/
61+
build --tag $TAG_NS/postorius:rolling postorius/
3562
fi

web/Dockerfile

+2-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@ RUN --mount=type=cache,target=/root/.cache \
1717
&& python3 -m pip install --break-system-packages -U 'Django<4.3' pip setuptools wheel \
1818
&& pip install --break-system-packages -r /tmp/requirements.txt \
1919
whoosh \
20-
uwsgi \
20+
# later builds of uwsgi don't compile on aarch64
21+
uwsgi==2.0.25 \
2122
psycopg2 \
2223
dj-database-url \
2324
mysqlclient \

0 commit comments

Comments
 (0)