github.com/influx6/npkg@v0.8.8/.travis/main.sh (about) 1 #!/usr/bin/env bash 2 3 # Set an option to exit immediately if any error appears 4 set -o errexit 5 6 # Main function that describes the behavior of the 7 # script. 8 # By making it a function we can place our methods 9 # below and have the main execution described in a 10 # concise way via function invocations. 11 main() { 12 setup_dependencies 13 update_docker_configuration 14 15 echo "SUCCESS: 16 Done! Finished setting up Travis machine. 17 " 18 } 19 20 # Prepare the dependencies that the machine need. 21 # Here I'm just updating the apt references and then 22 # installing both python and python-pip. This allows 23 # us to make use of `pip` to fetch the latest `docker-compose` 24 # later. 25 # We also upgrade `docker-ce` so that we can get the 26 # latest docker version which allows us to perform 27 # image squashing as well as multi-stage builds. 28 setup_dependencies() { 29 echo "INFO: 30 Setting up dependencies. 31 " 32 33 sudo apt update -y 34 sudo apt install realpath python python-pip -y 35 sudo apt install --only-upgrade docker-ce -y 36 37 sudo pip install docker-compose || true 38 39 docker info 40 docker-compose --version 41 } 42 43 # Tweak the daemon configuration so that we 44 # can make use of experimental features (like image 45 # squashing) as well as have a bigger amount of 46 # concurrent downloads and uploads. 47 update_docker_configuration() { 48 echo "INFO: 49 Updating docker configuration 50 " 51 52 echo '{ 53 "experimental": true, 54 "storage-driver": "overlay2", 55 "max-concurrent-downloads": 50, 56 "max-concurrent-uploads": 50 57 }' | sudo tee /etc/docker/daemon.json 58 sudo service docker restart 59 } 60 61 main