Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
sudo: required
language: generic
language: go

services:
- docker
Expand All @@ -9,7 +9,10 @@ services:
env:
global:
- SOURCE_BRANCH=$TRAVIS_BRANCH
- IMAGE_NAME=coala-docker
- IMAGE_NAME=coala-docker:this

before_install:
- go get github.com/grammarly/rocker

install:
- hooks/build
Expand Down
4 changes: 4 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,8 @@ RUN \
time zypper clean -a && \
find /tmp -mindepth 1 -prune -exec rm -rf '{}' '+'

# rocker TAG {{ .image }}_suse

# Coala setup and python deps
RUN cd / && \
git clone --depth 1 --branch=$branch https://github.com/coala/coala.git && \
Expand Down Expand Up @@ -346,3 +348,5 @@ RUN mkdir -p /root/.local/share/coala-bears/ScalaLintBear && \
# Entrypoint script
ADD docker-coala.sh /usr/local/bin/
CMD ["/usr/local/bin/docker-coala.sh"]

# rocker TAG {{ .image }}
35 changes: 33 additions & 2 deletions hooks/build
Original file line number Diff line number Diff line change
@@ -1,9 +1,40 @@
#!/usr/bin/env bash

set -e -x

if [[ "${IMAGE_NAME/:/}" == "${IMAGE_NAME}" ]]; then
# DockerCloud uses :this for pull requests
IMAGE_NAME="${IMAGE_NAME}:this"
fi

ROCKER="$(which rocker | true)"

# On DockerCloud, include the rocker command added in pre_build
if [[ -z "$ROCKER" && -f "$HOME/goroot/bin/rocker" ]]; then
TOOL="$HOME/goroot/bin/rocker"
fi

if [[ -z "$TOOL" ]]; then
if [[ -n "$ROCKER" ]]; then
TOOL="$ROCKER"
else
TOOL=docker
fi
fi

if [[ "${TOOL%docker}" != "$TOOL" ]]; then
TOOL_ARGS="-t $IMAGE_NAME"
elif [[ "${TOOL%rocker}" != "$TOOL" ]]; then
TOOL_ARGS="--var image=$IMAGE_NAME"
sed -i 's/^# rocker \([A-Z]*\) /\1 /' Dockerfile
fi

COALA_BRANCH=$(python guess_branch.py "$SOURCE_BRANCH")

echo "Building coala branch $COALA_BRANCH for docker branch $SOURCE_BRANCH"
echo "as image ${IMAGE_NAME}, using ${TOOL} on $(uname -a)."

docker build -f Dockerfile \
$TOOL build \
-f Dockerfile \
--build-arg=branch="$COALA_BRANCH" \
-t "$IMAGE_NAME" .
$TOOL_ARGS .
11 changes: 11 additions & 0 deletions hooks/pre_build
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/usr/bin/env bash

set -e -x

# This is run on DockerCloud, and not run on Travis

export DEBIAN_FRONTEND=noninteractive
export GOPATH=$HOME/goroot

time apt-get --yes install golang-1.6-go
time /usr/lib/go-1.6/bin/go get github.com/grammarly/rocker