Swtich to new Docker Compose.

This commit is contained in:
Buster "Silver Eagle" Neece 2021-12-15 14:48:08 -06:00
parent a3e8c0648c
commit 22c57cd57e
No known key found for this signature in database
GPG Key ID: 9FC8B9E008872109
1 changed files with 18 additions and 41 deletions

View File

@ -2,7 +2,7 @@
# shellcheck disable=SC2145,SC2178,SC2120,SC2162
# Constants
export COMPOSE_VERSION=1.29.2
export COMPOSE_VERSION=2.2.2
# Functions to manage .env files
__dotenv=
@ -318,15 +318,22 @@ install-docker() {
}
install-docker-compose() {
curl -fsSL https://github.com/docker/compose/releases/download/${COMPOSE_VERSION}/docker-compose-$(uname -s)-$(uname -m) -o docker-compose
curl -fsSL https://raw.githubusercontent.com/docker/compose-switch/master/install_on_linux.sh -o install-compose-switch.sh
if [[ $EUID -ne 0 ]]; then
sudo sh -c "curl -fsSL https://github.com/docker/compose/releases/download/${COMPOSE_VERSION}/docker-compose-$(uname -s)-$(uname -m) -o /usr/local/bin/docker-compose"
sudo chmod +x /usr/local/bin/docker-compose
sudo sh -c "curl -fsSL https://raw.githubusercontent.com/docker/compose/${COMPOSE_VERSION}/contrib/completion/bash/docker-compose -o /etc/bash_completion.d/docker-compose"
sudo chmod a+x ./docker-compose
sudo mv ./docker-compose /usr/libexec/docker/cli-plugins/docker-compose
sudo sh install-compose-switch.sh
else
curl -fsSL https://github.com/docker/compose/releases/download/${COMPOSE_VERSION}/docker-compose-$(uname -s)-$(uname -m) -o /usr/local/bin/docker-compose
chmod +x /usr/local/bin/docker-compose
curl -fsSL https://raw.githubusercontent.com/docker/compose/${COMPOSE_VERSION}/contrib/completion/bash/docker-compose -o /etc/bash_completion.d/docker-compose
chmod a+x ./docker-compose
mv ./docker-compose /usr/libexec/docker/cli-plugins/docker-compose
sh install-compose-switch.sh
fi
rm install-docker-compose.sh
}
run-installer() {
@ -367,18 +374,8 @@ install() {
fi
fi
if [[ $(command -v docker-compose) && $(docker-compose --version) ]]; then
# Check for update to Docker Compose
local CURRENT_COMPOSE_VERSION
CURRENT_COMPOSE_VERSION=$(docker-compose version --short)
if [ "$(version-number "$COMPOSE_VERSION")" -gt "$(version-number "$CURRENT_COMPOSE_VERSION")" ]; then
if ask "Your version of Docker Compose is out of date. Attempt to update it automatically?" Y; then
install-docker-compose
fi
else
echo "Docker Compose is already installed and up to date! Continuing..."
fi
if [[ $(command -v docker-compose) ]]; then
echo "Docker Compose is already installed. Continuing..."
else
if ask "Docker Compose does not appear to be installed. Install Docker Compose now?" Y; then
install-docker-compose
@ -419,18 +416,8 @@ install-dev() {
fi
fi
if [[ $(command -v docker-compose) && $(docker-compose --version) ]]; then
# Check for update to Docker Compose
local CURRENT_COMPOSE_VERSION
CURRENT_COMPOSE_VERSION=$(docker-compose version --short)
if [ "$(version-number "$COMPOSE_VERSION")" -gt "$(version-number "$CURRENT_COMPOSE_VERSION")" ]; then
if ask "Your version of Docker Compose is out of date. Attempt to update it automatically?" Y; then
install-docker-compose
fi
else
echo "Docker Compose is already installed and up to date! Continuing..."
fi
if [[ $(command -v docker-compose) ]]; then
echo "Docker Compose is already installed. Continuing..."
else
if ask "Docker Compose does not appear to be installed. Install Docker Compose now?" Y; then
install-docker-compose
@ -517,16 +504,6 @@ update() {
rm docker.new.sh
fi
# Check for update to Docker Compose
local CURRENT_COMPOSE_VERSION
CURRENT_COMPOSE_VERSION=$(docker-compose version --short)
if [ "$(version-number "$COMPOSE_VERSION")" -gt "$(version-number "$CURRENT_COMPOSE_VERSION")" ]; then
if ask "Your version of Docker Compose is out of date. Attempt to update it automatically?" Y; then
install-docker-compose
fi
fi
run-installer --update "$@"
# Check for updated Docker Compose config.