mirror of
https://github.com/krislamo/graylog_demo
synced 2024-12-16 06:50:35 +00:00
Install docker-compose
This commit is contained in:
parent
690d72e219
commit
1248d921b5
3
Vagrantfile
vendored
3
Vagrantfile
vendored
@ -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
38
install-compose.sh
Executable 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
|
Loading…
Reference in New Issue
Block a user