summaryrefslogtreecommitdiff
path: root/.gitlab
diff options
context:
space:
mode:
authorJonas Zohren <git-pbkyr@jzohren.de>2022-10-29 14:32:22 +0200
committerJonas Zohren <git-pbkyr@jzohren.de>2022-11-02 12:12:48 +0100
commitb37876f3b2280cab122b46f15290979eef355ea3 (patch)
tree45d894e75e7df7d6797d21b6a294cd2925c2bfff /.gitlab
parent4af998963b62e70fe3b222dc873c5e84749de929 (diff)
downloadconduit-b37876f3b2280cab122b46f15290979eef355ea3.zip
fix(ci): Only build in (remote host) docker and switch to glibc
Diffstat (limited to '.gitlab')
-rw-r--r--.gitlab/setup-buildx-remote-builders.sh37
1 files changed, 37 insertions, 0 deletions
diff --git a/.gitlab/setup-buildx-remote-builders.sh b/.gitlab/setup-buildx-remote-builders.sh
new file mode 100644
index 0000000..29d50dd
--- /dev/null
+++ b/.gitlab/setup-buildx-remote-builders.sh
@@ -0,0 +1,37 @@
+#!/bin/sh
+set -eux
+
+# --------------------------------------------------------------------- #
+# #
+# Configures docker buildx to use a remote server for arm building. #
+# Expects $SSH_PRIVATE_KEY to be a valid ssh ed25519 private key with #
+# access to the server $ARM_SERVER_USER@$ARM_SERVER_IP #
+# #
+# This is expected to only be used in the official CI/CD pipeline! #
+# #
+# Requirements: openssh-client, docker buildx #
+# Inspired by: https://depot.dev/blog/building-arm-containers #
+# #
+# --------------------------------------------------------------------- #
+
+cat "$BUILD_SERVER_SSH_PRIVATE_KEY" | ssh-add -
+
+# Test server connections:
+ssh "$ARM_SERVER_USER@$ARM_SERVER_IP" "uname -a"
+ssh "$AMD_SERVER_USER@$AMD_SERVER_IP" "uname -a"
+
+# Connect remote arm64 server for all arm builds:
+docker buildx create \
+ --name "multi" \
+ --driver "docker-container" \
+ --platform "linux/arm64,linux/arm/v7" \
+ "ssh://$ARM_SERVER_USER@$ARM_SERVER_IP"
+
+# Connect remote amd64 server for adm64 builds:
+docker buildx create --append \
+ --name "multi" \
+ --driver "docker-container" \
+ --platform "linux/amd64" \
+ "ssh://$AMD_SERVER_USER@$AMD_SERVER_IP"
+
+docker buildx use multi