forked from NginxProxyManager/nginx-proxy-manager
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuildx
executable file
·36 lines (29 loc) · 970 Bytes
/
buildx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#!/bin/bash
DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
. "$DIR/.common.sh"
echo -e "${BLUE}❯ ${CYAN}Building docker multiarch: ${YELLOW}${*}${RESET}"
DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
cd "${DIR}/.." || exit 1
# determine commit if not already set
if [ "$BUILD_COMMIT" == "" ]; then
BUILD_COMMIT=$(git log -n 1 --format=%h)
fi
# Buildx Builder
docker buildx create --name "${BUILDX_NAME:-npm}" || echo
docker buildx use "${BUILDX_NAME:-npm}"
docker buildx build \
--build-arg BUILD_VERSION="${BUILD_VERSION:-dev}" \
--build-arg BUILD_COMMIT="${BUILD_COMMIT:-notset}" \
--build-arg BUILD_DATE="$(date '+%Y-%m-%d %T %Z')" \
--build-arg GOPROXY="${GOPROXY:-}" \
--build-arg GOPRIVATE="${GOPRIVATE:-}" \
--platform linux/amd64,linux/arm64,linux/arm/7 \
--progress plain \
--pull \
-f docker/Dockerfile \
$@ \
.
rc=$?
docker buildx rm "${BUILDX_NAME:-npm}"
echo -e "${BLUE}❯ ${GREEN}Multiarch build Complete${RESET}"
exit $rc