-
Notifications
You must be signed in to change notification settings - Fork 0
/
.travis.yml
29 lines (24 loc) · 850 Bytes
/
.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
# https://docs.travis-ci.com/user/docker/
services:
- docker
env:
- REPO=$DOCKERHUB_USERNAME/docker-centos7-ansible
before_install:
- sudo apt-get update -y
- sudo apt-get -y -o Dpkg::Options::="--force-confnew" install docker-ce
script:
# Building the container.
- docker build -t $REPO .
# Test running the container.
- docker run --name container -d --privileged -v /sys/fs/cgroup:/sys/fs/cgroup:ro $REPO /usr/lib/systemd/systemd
- docker exec -it container which ansible
- docker exec -it container which ansible-lint
after_success:
# Pushing the container to docker hub
- docker login -u "$DOCKERHUB_USERNAME" -p "$DOCKERHUB_PASSWORD"
- if [ "$TRAVIS_BRANCH" == "master" ]; then
docker tag $REPO $REPO:$TRAVIS_COMMIT;
docker tag $REPO $REPO:latest;
fi
- docker push $REPO:$TRAVIS_COMMIT
- docker push $REPO:latest