1
0
mirror of https://github.com/pgrondek/config.git synced 2024-11-22 12:03:43 +00:00

[docker] add option to update docker compose

This commit is contained in:
Przemysław Grondek 2019-11-26 10:35:19 +01:00
parent e699c42c60
commit 4ed787d23e

View File

@ -22,6 +22,8 @@ HOME_BIN_DIR=$(HOME)/bin
DOCKER_BIN=/usr/bin/docker DOCKER_BIN=/usr/bin/docker
DOCKER_COMPOSE_BIN=$(HOME_BIN_DIR)/docker-compose DOCKER_COMPOSE_BIN=$(HOME_BIN_DIR)/docker-compose
DOCKER_REPO_FILE=/etc/apt/sources.list.d/docker.list DOCKER_REPO_FILE=/etc/apt/sources.list.d/docker.list
DOCKER_COMPOSE_VERSION=1.25.0
DOCKER_COMPOSE_URL=https://github.com/docker/compose/releases/download/$(DOCKER_COMPOSE_VERSION)/docker-compose-$(shell uname -s)-$(shell uname -m)
ROOT_TEE=sudo tee ROOT_TEE=sudo tee
ROOT_APT=sudo aptitude ROOT_APT=sudo aptitude
@ -29,16 +31,28 @@ ROOT_ADD_KEY=sudo apt-key
ROOT_ADD_USER_TO_GROUP=sudo adduser ROOT_ADD_USER_TO_GROUP=sudo adduser
RELEASE:=$(shell lsb_release -cs) RELEASE:=$(shell lsb_release -cs)
clean: clean: clean_docker clean_compose
clean_docker:
-docker system prune -docker system prune
-$(ROOT_APT) remove $(DOCKER_PACKAGES) -$(ROOT_APT) remove $(DOCKER_PACKAGES)
sudo rm -f $(DOCKER_COMPOSE_BIN)
sudo rm -f $(DOCKER_REPO_FILE) sudo rm -f $(DOCKER_REPO_FILE)
-$(ROOT_ADD_KEY) del Docker -$(ROOT_ADD_KEY) del Docker
clean_compose:
rm -f $(DOCKER_COMPOSE_BIN)
install: install_docker install_compose install: install_docker install_compose
install_docker: $(DOCKER_BIN) install_docker: $(DOCKER_BIN)
install_compose: $(DOCKER_COMPOSE_BIN)
install_compose:
ifeq ("$(wildcard $(DOCKER_COMPOSE_BIN))","")
$(MAKE) download_install_compose
else ifneq ($(shell docker-compose -v | awk -F'[, ]' '{print $$3}'), $(DOCKER_COMPOSE_VERSION))
$(MAKE) download_install_compose
endif
force_update_compose: clean_compose install_compose
$(DOCKER_BIN): $(DOCKER_BIN):
-$(ROOT_APT) remove $(CLEAN_PACKAGES) -$(ROOT_APT) remove $(CLEAN_PACKAGES)
@ -52,8 +66,8 @@ $(DOCKER_BIN):
$(ROOT_ADD_USER_TO_GROUP) $(shell id -nu) docker $(ROOT_ADD_USER_TO_GROUP) $(shell id -nu) docker
$(DOCKER_COMPOSE_BIN): $(HOME_BIN_DIR) download_install_compose: $(HOME_BIN_DIR)
curl -L "https://github.com/docker/compose/releases/download/1.24.1/docker-compose-$(shell uname -s)-$(shell uname -m)" -o $(DOCKER_COMPOSE_BIN) curl -L $(DOCKER_COMPOSE_URL) -o $(DOCKER_COMPOSE_BIN)
chmod +x $(DOCKER_COMPOSE_BIN) chmod +x $(DOCKER_COMPOSE_BIN)
$(HOME_BIN_DIR): $(HOME_BIN_DIR):