-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathbuild
executable file
·40 lines (35 loc) · 989 Bytes
/
build
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
37
38
39
40
#!/bin/bash
#
# Docker build hook override
#
# See https://docs.docker.com/docker-cloud/builds/advanced/
#
# Optimize shell for safety.
set -o errexit -o noclobber -o nounset -o pipefail -o xtrace
# Define variables.
{ echo "Determine which Dockerfile to use:"; } 2> /dev/null
DOCKERFILE="Dockerfile"
if [[ "$DOCKER_TAG" =~ ^(amd64|i386)$ ]]; then
DOCKERFILE="Dockerfile-debian"
fi
# Define arguments
ARCH_NAME=""
FLICLIB_ARCH=""
if [[ "$DOCKER_TAG" =~ ^(aarch64|amd64|armv7hf|i386|rpi)$ ]]; then
ARCH_NAME="--build-arg ARCH_NAME=$DOCKER_TAG"
fi
if [[ "$DOCKER_TAG" =~ ^(i386)$ ]]; then
FLICLIB_ARCH="--build-arg FLICLIB_ARCH=$DOCKER_TAG"
fi
# Build Docker image.
{ echo "Build Docker image:"; } 2> /dev/null
docker build \
--build-arg BUILD_DATE="$(date -u +'%Y-%m-%dT%H:%M:%SZ')" \
--build-arg VCS_REF="$(git rev-parse --short HEAD)" \
$ARCH_NAME \
$FLICLIB_ARCH \
--tag "$IMAGE_NAME" \
--file "$DOCKERFILE" \
.
# Exit with the status of the last command
exit $?