|
@@ -1,15 +1,30 @@
|
|
|
-TAG=$(git rev-parse --short HEAD)
|
|
|
|
|
|
|
+#!/usr/bin/env bash
|
|
|
|
|
+set -euo pipefail
|
|
|
|
|
+
|
|
|
|
|
+TAG="$(git rev-parse --short HEAD)"
|
|
|
NAME="docker.dezendorf.net/code-server"
|
|
NAME="docker.dezendorf.net/code-server"
|
|
|
YAML="../../dezendorf/homelab/k3s/codeserver/codeserver.yaml"
|
|
YAML="../../dezendorf/homelab/k3s/codeserver/codeserver.yaml"
|
|
|
-docker build --no-cache -t ${NAME}:${TAG} . < Dockerfile
|
|
|
|
|
-docker push ${NAME}:${TAG}
|
|
|
|
|
-docker push ${NAME}:latest
|
|
|
|
|
|
|
+PLATFORMS="${PLATFORMS:-linux/amd64,linux/arm64}"
|
|
|
|
|
+
|
|
|
|
|
+if ! docker buildx version >/dev/null 2>&1; then
|
|
|
|
|
+ echo "docker buildx is required for multi-arch builds" >&2
|
|
|
|
|
+ exit 1
|
|
|
|
|
+fi
|
|
|
|
|
|
|
|
-echo "Built and pushed:"
|
|
|
|
|
|
|
+docker buildx build \
|
|
|
|
|
+ --no-cache \
|
|
|
|
|
+ --platform "${PLATFORMS}" \
|
|
|
|
|
+ --tag "${NAME}:${TAG}" \
|
|
|
|
|
+ --tag "${NAME}:latest" \
|
|
|
|
|
+ --push \
|
|
|
|
|
+ -f Dockerfile \
|
|
|
|
|
+ .
|
|
|
|
|
+
|
|
|
|
|
+echo "Built and pushed multi-arch images:"
|
|
|
echo " ${NAME}:${TAG}"
|
|
echo " ${NAME}:${TAG}"
|
|
|
echo " ${NAME}:latest"
|
|
echo " ${NAME}:latest"
|
|
|
|
|
+echo " platforms=${PLATFORMS}"
|
|
|
|
|
|
|
|
-sed -i -e "s#$NAME:.*#$NAME:$TAG#g" ${YAML}
|
|
|
|
|
-git add ${YAML}
|
|
|
|
|
-git commit -m "releasing $NAME:$TAG"
|
|
|
|
|
-
|
|
|
|
|
|
|
+sed -i -e "s#${NAME}:.*#${NAME}:${TAG}#g" "${YAML}"
|
|
|
|
|
+git add "${YAML}"
|
|
|
|
|
+git commit -m "releasing ${NAME}:${TAG}"
|