Skip to content

Commit

Permalink
Merge pull request #131 from buildkite/custom-docker-file
Browse files Browse the repository at this point in the history
Add BUILDKITE_DOCKER_FILE to specify the Docker file
  • Loading branch information
toolmantim committed Apr 10, 2015
2 parents 0fd95d7 + 83a5eae commit 31cc9a8
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions templates/bootstrap.sh
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ else
# We pipe into cat because the default tty output kills our renderer.
# If there was a wget-style --progress=dot we'd use it instead.
# https://github.com/docker/docker/issues/3694
buildkite-run "docker build -t $DOCKER_IMAGE . | cat"
buildkite-run "docker build -f ${BUILDKITE_DOCKER_FILE:-Dockerfile} -t $DOCKER_IMAGE . | cat"

# Run the build script command in a one-off container
echo "~~~ Running build script (in Docker container)"
Expand All @@ -305,11 +305,12 @@ else
COMPOSE_PROJ_NAME="buildkite"${BUILDKITE_JOB_ID//-}
# The name of the docker container compose creates when it creates the adhoc run
COMPOSE_CONTAINER_NAME=$COMPOSE_PROJ_NAME"_"$BUILDKITE_DOCKER_COMPOSE_CONTAINER
COMPOSE_COMMAND="docker-compose -f ${BUILDKITE_DOCKER_COMPOSE_FILE:-docker-compose.yml} -p $COMPOSE_PROJ_NAME"

function compose-cleanup {
echo "~~~ Cleaning up Docker containers"
buildkite-run "docker-compose -p $COMPOSE_PROJ_NAME kill || true"
buildkite-run "docker-compose -p $COMPOSE_PROJ_NAME rm --force -v || true"
buildkite-run "$COMPOSE_COMMAND kill || true"
buildkite-run "$COMPOSE_COMMAND rm --force -v || true"

# The adhoc run container isn't cleaned up by compose, so we have to do it ourselves
buildkite-run "docker rm -f -v "$COMPOSE_CONTAINER_NAME"_run_1 || true"
Expand All @@ -323,11 +324,11 @@ else
# We pipe into cat because the default tty output kills our renderer.
# If there was a wget-style --progress=dot we'd use it instead.
# https://github.com/docker/docker/issues/3694
buildkite-run "docker-compose -p $COMPOSE_PROJ_NAME build | cat"
buildkite-run "$COMPOSE_COMMAND build | cat"

# Run the build script command in the service specified in BUILDKITE_DOCKER_COMPOSE_CONTAINER
echo "~~~ Running build script (in Docker Compose container)"
buildkite-prompt-and-run "docker-compose -p $COMPOSE_PROJ_NAME run $BUILDKITE_DOCKER_COMPOSE_CONTAINER ./$BUILDKITE_SCRIPT_PATH"
buildkite-prompt-and-run "$COMPOSE_COMMAND run $BUILDKITE_DOCKER_COMPOSE_CONTAINER ./$BUILDKITE_SCRIPT_PATH"

# Capture the exit status from the build script
export BUILDKITE_COMMAND_EXIT_STATUS=$?
Expand Down

0 comments on commit 31cc9a8

Please sign in to comment.