forked from conda-forge/staged-recipes
-
Notifications
You must be signed in to change notification settings - Fork 1
/
run_docker_build.sh
executable file
·43 lines (34 loc) · 1.36 KB
/
run_docker_build.sh
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
41
42
43
#!/usr/bin/env bash
# NOTE: This script has been adapted from content generated by github.com/conda-forge/conda-smithy
REPO_ROOT=$(cd "$(dirname "$0")/.."; pwd;)
IMAGE_NAME="condaforge/linux-anvil-comp7"
ARTIFACTS="$REPO_ROOT/build_artifacts"
THISDIR="$( cd "$( dirname "$0" )" >/dev/null && pwd )"
PROVIDER_DIR="$(basename $THISDIR)"
AZURE="${AZURE:-False}"
docker info
# In order for the conda-build process in the container to write to the mounted
# volumes, we need to run with the same id as the host machine, which is
# normally the owner of the mounted volumes, or at least has write permission
HOST_USER_ID=$(id -u)
# Check if docker-machine is being used (normally on OSX) and get the uid from
# the VM
if hash docker-machine 2> /dev/null && docker-machine active > /dev/null; then
HOST_USER_ID=$(docker-machine ssh $(docker-machine active) id -u)
fi
mkdir -p "$ARTIFACTS"
DONE_CANARY="$ARTIFACTS/conda-forge-build-done"
rm -f "$DONE_CANARY"
DOCKER_RUN_ARGS="-it"
if [ "${AZURE}" == "True" ]; then
DOCKER_RUN_ARGS=""
fi
docker run ${DOCKER_RUN_ARGS} \
-v ${REPO_ROOT}:/home/conda/staged-recipes \
-e HOST_USER_ID=${HOST_USER_ID} \
-e AZURE=${AZURE} \
$IMAGE_NAME \
bash \
/home/conda/staged-recipes/${PROVIDER_DIR}/build_steps.sh
# verify that the end of the script was reached
test -f "$DONE_CANARY"