This repository has been archived by the owner on Aug 21, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 16
/
.travis.yml
executable file
·47 lines (40 loc) · 2.17 KB
/
.travis.yml
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
44
45
46
47
language: c
env:
global:
- IMAGE_NAME=busybox-java
- IMAGE_TAGS="latest 8 8u45 serverjre8 serverjre8u45"
- PUBLISH_IF_BRANCH=master # Publish only when building from this branch, not branches created from it
# HUB_USERNAME, HUB_PASSWORD and HUB_EMAIL should be configured from the Travis repository settings
- "HOST_IP=$(/sbin/ifconfig venet0:0 | grep 'inet addr' | awk -F: '{print $2}' | awk '{print $1}')"
- DOCKER_HOST=tcp://$HOST_IP:2375
- DOCKER_PORT_RANGE=2400:2500
- SLIRP_PORTS=$(seq 2375 2500)
before_install:
- sudo sh -c "wget -qO- https://get.docker.com/gpg | apt-key add -"
- sudo sh -c "echo deb https://get.docker.com/ubuntu docker main > /etc/apt/sources.list.d/docker.list"
- echo exit 101 | sudo tee /usr/sbin/policy-rc.d
- sudo chmod +x /usr/sbin/policy-rc.d
install:
- sudo apt-get -qqy update
- sudo apt-get -qqy install lxc lxc-docker-1.3.3 slirp
- sudo sudo usermod -aG docker "$USER"
- git clone git://github.com/cptactionhank/sekexe
before_script:
- "sekexe/run 'mount -t tmpfs -o size=1g tmpfs /var/lib/docker && docker -d -H tcp://0.0.0.0:2375' &"
- "while ! docker info &> /dev/null ; do sleep 1; done"
- docker version
# Log in to Docker Hub
- "if [ $TRAVIS_PULL_REQUEST = false ] && [ $TRAVIS_BRANCH = $PUBLISH_IF_BRANCH ] && [ -n \"$HUB_USERNAME\" ] && [ -n \"$HUB_PASSWORD\" ]; then PUBLISH_IMAGE=true; echo 'Publishing!'; else PUBLISH_IMAGE=false; echo 'Not publishing!'; fi"
- "if [ $PUBLISH_IMAGE = true ]; then docker login -u $HUB_USERNAME -p $HUB_PASSWORD -e $HUB_EMAIL; fi"
after_script:
# Log out from Docker Hub
- "if [ $PUBLISH_IMAGE = true ]; then docker logout; fi"
script:
# Fetch previous versions to avoid duplicating stuff
- "if [ $PUBLISH_IMAGE = true ]; then docker pull $HUB_USERNAME/$IMAGE_NAME:$(echo \"$IMAGE_TAGS\" | awk '{print $1}') || true; fi"
# Build
- docker build -t $IMAGE_NAME .
# Test
- docker run $IMAGE_NAME java -version
# Publish
- "if [ $PUBLISH_IMAGE = true ]; then for IMAGE_TAG in $IMAGE_TAGS; do docker build -t $HUB_USERNAME/$IMAGE_NAME:$IMAGE_TAG .; docker push $HUB_USERNAME/$IMAGE_NAME:$IMAGE_TAG; done; fi"