1
0
mirror of https://github.com/imgproxy/imgproxy.git synced 2024-11-24 08:12:38 +02:00
imgproxy/docker/build.sh
2024-03-22 16:59:29 +03:00

24 lines
621 B
Bash
Executable File

#!/bin/bash
set -e
# This is pretty dirty hack. Building imgproxy under Qemu is pretty slow.
# So we install Go binary native for the BUILDARCH.
if [[ $BUILDARCH != $TARGETARCH ]]; then
GOLANG_VERSION=$(go version | sed -E 's/.*go([0-9]+\.[0-9]+(\.[0-9]+)?).*/\1/')
rm -rf /usr/local/go
apt-get update
apt-get install -y --no-install-recommends libstdc++6:${BUILDARCH}
curl -Ls https://golang.org/dl/go${GOLANG_VERSION}.linux-${BUILDARCH}.tar.gz \
| tar -xzC /usr/local
export CGO_ENABLED=1
export GOOS=linux
export GOARCH=$TARGETARCH
fi
go build -v -ldflags "-s -w" -o /usr/local/bin/imgproxy