@@ -10,26 +10,53 @@ export BUILD_ROLLING="${1:-no}"
1010
1111DOCKER=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+
1340if [ " $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/
2956else
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/
3562fi
0 commit comments