1
0
mirror of https://github.com/krislamo/graylog_demo synced 2024-11-09 21:50:35 +00:00

Install docker-compose

This commit is contained in:
Kris Lamoureux 2020-01-22 10:20:11 -05:00
parent 690d72e219
commit 1248d921b5
Signed by: kris
GPG Key ID: A30022791E1719A4
2 changed files with 41 additions and 0 deletions

3
Vagrantfile vendored
View File

@ -17,4 +17,7 @@ Vagrant.configure("2") do |config|
SHELL
# Install newest docker-compose
config.vm.provision "shell", path: "install-compose.sh"
end

38
install-compose.sh Executable file
View File

@ -0,0 +1,38 @@
#!/bin/bash
# Github username and repo name
user="docker"
repo="compose"
# Retrieve the latest version number
addr="https://github.com/$user/$repo/releases/latest"
page=$(curl -s $addr | grep -o releases/tag/*.*\")
version=$(echo $page | awk '{print substr($1, 14, length($1) - 14)}')
# Download prep
url="https://github.com/$user/$repo/releases/download/$version"
file="docker-compose-$(uname -s)-$(uname -m)"
# Download latest Docker Compose if that version hasn't been downloaded
if [ ! -f /tmp/docker_compose_$version ]; then
curl -L $url/$file -o /tmp/docker-compose_$version
fi
# Is it already installed?
if installed=$(which docker-compose); then
new_chksum=$(sha256sum /tmp/docker-compose_$version)
old_chksum=$(sha256sum /usr/local/bin/docker-compose)
# If checksums are different, delete and install new version
if [ ! "$new_chksum" = "$old_chksum" ]; then
rm /usr/local/bin/docker-compose
mv /tmp/docker-compose_$version /usr/local/bin/docker-compose
chmod +x /usr/local/bin/docker-compose
fi
else
# It's not installed, so no need to remove
mv /tmp/docker-compose_$version /usr/local/bin/docker-compose
chmod +x /usr/local/bin/docker-compose
fi