2023-05-30 15:48:23 +02:00
|
|
|
#!/bin/sh -e
|
|
|
|
|
|
|
|
docker login --username "$DOCKER_USERNAME" --password "$DOCKER_PASSWORD"
|
|
|
|
|
|
|
|
docker buildx create --use --name wp --driver remote tcp://192.168.69.1:1234
|
|
|
|
|
2023-05-30 15:56:53 +02:00
|
|
|
has_riscv=0
|
2023-05-30 15:48:23 +02:00
|
|
|
if ping -c 1 192.168.69.206; then
|
2023-05-30 15:49:27 +02:00
|
|
|
docker buildx create --append --name wp --driver remote tcp://192.168.69.206:1234
|
2023-05-30 15:56:53 +02:00
|
|
|
has_riscv=1
|
2023-05-30 15:48:23 +02:00
|
|
|
fi
|
|
|
|
|
2023-05-30 15:56:53 +02:00
|
|
|
has_x86=0
|
2023-05-30 18:51:22 +02:00
|
|
|
for f in 192.168.69.236 192.168.69.207; do
|
|
|
|
if ping -c 1 $f; then
|
|
|
|
docker buildx create --append --name wp --driver remote tcp://$f:1234
|
|
|
|
has_x86=1
|
|
|
|
break
|
|
|
|
fi
|
|
|
|
done
|
2023-05-30 15:56:53 +02:00
|
|
|
|
2023-05-30 19:02:55 +02:00
|
|
|
arches="arm64"
|
2023-05-30 15:56:53 +02:00
|
|
|
if [ $has_x86 -eq 1 ]; then
|
2023-05-30 19:02:55 +02:00
|
|
|
arches="$arches amd64"
|
2023-05-30 15:48:23 +02:00
|
|
|
fi
|
|
|
|
|
2023-05-30 18:51:22 +02:00
|
|
|
if [ $has_riscv -eq 1 ]; then
|
2023-05-30 19:02:55 +02:00
|
|
|
arches="$arches riscv64"
|
2023-05-30 18:51:22 +02:00
|
|
|
fi
|
|
|
|
|
2023-05-30 19:02:55 +02:00
|
|
|
echo "Building for $arches"
|
2023-05-30 18:51:22 +02:00
|
|
|
|
|
|
|
for f in alpine debian; do
|
2023-05-30 19:02:55 +02:00
|
|
|
manifest=""
|
|
|
|
for arch in $arches; do
|
2023-05-30 19:05:23 +02:00
|
|
|
cp tests/dockerfiles/Dockerfile.$f Dockerfile.$arch
|
2023-05-30 19:02:55 +02:00
|
|
|
if [ "$arch" == "riscv64" ]; then
|
2023-05-30 19:05:23 +02:00
|
|
|
sed "s|FROM .*|FROM danog/php:8.2-fpm-$f|" -i Dockerfile.$arch
|
2023-05-30 19:02:55 +02:00
|
|
|
fi
|
|
|
|
docker buildx build --platform linux/$arch . \
|
2023-05-30 19:05:23 +02:00
|
|
|
-f Dockerfile.$arch \
|
2023-05-30 19:02:55 +02:00
|
|
|
-t danog/madelineproto:$arch-next-$f \
|
|
|
|
--cache-from danog/madelineproto:next-$f \
|
2023-05-30 19:05:23 +02:00
|
|
|
--cache-to type=inline &
|
2023-05-30 19:02:55 +02:00
|
|
|
|
|
|
|
manifest="$manifest danog/madelineproto:$arch-next-$f"
|
|
|
|
done
|
2023-05-30 19:05:23 +02:00
|
|
|
wait
|
2023-05-30 19:02:55 +02:00
|
|
|
|
|
|
|
docker manifest create danog/madelineproto:next-$f $manifest
|
|
|
|
docker manifest push danog/madelineproto:next-$f
|
2023-05-30 15:48:23 +02:00
|
|
|
|
|
|
|
if [ "$CI_COMMIT_TAG" != "" ]; then
|
2023-05-30 16:00:17 +02:00
|
|
|
docker tag danog/madelineproto:next-$f danog/madelineproto:$f
|
|
|
|
docker push danog/madelineproto:$f
|
2023-05-30 15:48:23 +02:00
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
2023-05-30 16:00:17 +02:00
|
|
|
docker tag danog/madelineproto:next-debian danog/madelineproto:next
|
|
|
|
docker push danog/madelineproto:next
|
2023-05-30 15:48:23 +02:00
|
|
|
|
|
|
|
if [ "$CI_COMMIT_TAG" != "" ]; then
|
2023-05-30 16:00:17 +02:00
|
|
|
docker tag danog/madelineproto:next danog/madelineproto:latest
|
|
|
|
docker push danog/madelineproto:latest
|
2023-05-30 15:48:23 +02:00
|
|
|
fi
|