diff --git a/.travis.yml b/.travis.yml index 7515ece..46e83fe 100644 --- a/.travis.yml +++ b/.travis.yml @@ -30,6 +30,7 @@ deploy: - provider: script skip-cleanup: true script: + - echo "$docker_pwd" | docker login -u "$docker_login" --password-stdin - make publish on: branch: master diff --git a/Makefile b/Makefile index 04c4cf6..4642f08 100644 --- a/Makefile +++ b/Makefile @@ -7,11 +7,6 @@ MAKEFLAGS += --warn-undefined-variables MAKEFLAGS += --no-builtin-rules docker_repo := zokradonh -# if not run in travis, get docker_login and _pwd from file -ifndef TRAVIS - docker_login := $(shell cat ~/.docker-account-user) - docker_pwd := $(shell cat ~/.docker-account-pwd) -endif base_download_version := $(shell ./version.sh core) core_download_version := $(shell ./version.sh core) @@ -59,7 +54,7 @@ ifdef TRAVIS @echo "fetching previous build to warm up build cache (only on travis)" docker pull $(docker_repo)/kopano_$(component):builder || true endif - docker build \ + docker build --rm \ --build-arg VCS_REF=$(vcs_ref) \ --build-arg docker_repo=${docker_repo} \ --build-arg KOPANO_CORE_VERSION=${core_download_version} \ @@ -82,7 +77,7 @@ endif .PHONY: build-simple build-simple: component ?= ssl build-simple: ## Helper target to build a simplified image (no Kopano repo integration). - docker build \ + docker build --rm \ --build-arg VCS_REF=$(vcs_ref) \ --build-arg docker_repo=$(docker_repo) \ --cache-from $(docker_repo)/kopano_$(component):latest \ @@ -95,7 +90,8 @@ ifdef TRAVIS @echo "fetching previous build to warm up build cache (only on travis)" docker pull $(docker_repo)/kopano_$(component):builder || true endif - docker build --target builder \ + docker build --rm \ + --target builder \ --build-arg VCS_REF=$(vcf_ref) \ --build-arg docker_repo=${docker_repo} \ --build-arg KOPANO_CORE_VERSION=${core_download_version} \ @@ -170,7 +166,7 @@ build-webapp: component=webapp make build build-webapp-demo: ## Replaces the actual kopano_webapp container with one that has login hints for demo.kopano.com. - docker build \ + docker build --rm \ -f webapp/Dockerfile.demo \ -t $(docker_repo)/kopano_webapp webapp/ @@ -267,11 +263,9 @@ tag-zpush: component=zpush make tag-container # Docker publish -repo-login: ## Login at hub.docker.com - @echo $(docker_pwd) | docker login -u $(docker_login) --password-stdin .PHONY: publish -publish: repo-login +publish: make $(shell grep -o ^publish-.*: Makefile | grep -Ev 'publish-container' | uniq | sed s/://g | xargs) publish-container: component ?= base diff --git a/README.md b/README.md index 51cc5a3..97fd56f 100644 --- a/README.md +++ b/README.md @@ -143,7 +143,7 @@ Yes, that is certainly a possibility. Within the `examples/` directory you can f ### Some more commands for those unfamiliar with docker-compose -- Start ``docker-compose-yml`` file in the background: `docker-compose up -d` +- Start ``docker-compose.yml`` file in the background: `docker-compose up -d` - Get a status overview of the running containers: `docker-compose ps` - Stop compose running in the background: `docker-compose stop` - Destroy local containers and network interfaces: `docker-compose down` @@ -151,6 +151,7 @@ Yes, that is certainly a possibility. Within the `examples/` directory you can f - Run commands in a running container: `docker-compose exec kopano_server kopano-cli --list-users` - Get logs of a in the background running container: `docker-compose logs -f kopano_server` - Run a `kopano-backup`: `docker run --rm -it -v /var/run/kopano/:/var/run/kopano -v $(pwd):/kopano/path zokradonh/kopano_utils kopano-backup` + - Same command but getting volumes from the existing `kopano_server` container: `docker run --rm -it --volumes-from kopano_server -v /root/kopano-backup:/kopano/path zokradonh/kopano_utils kopano-backup -h` - Get a shell in a new container to (for example) run `kopano-migration-pst`: `docker run --rm -it -v /var/run/kopano/:/var/run/kopano -v $(pwd):/kopano/path zokradonh/kopano_utils` (to directly run kopano-migration-pst just append it to the command) ## Third party docker images diff --git a/version.sh b/version.sh index 0ef7a8f..35aadd6 100755 --- a/version.sh +++ b/version.sh @@ -63,14 +63,13 @@ zpush) fi ;; meet) - KOPANO_CORE_REPOSITORY_URL=${KOPANO_MEET_REPOSITORY_URL:-""} - if [[ $KOPANO_MEET_REPOSITORY_URL == http* ]]; then - version=$(curl -s -S -L "$KOPANO_MEET_REPOSITORY_URL"/Packages | grep -A2 "Package: kopano-meet-packages") - echo "${version##* }" - exit - fi - ;; - + KOPANO_MEET_REPOSITORY_URL=${KOPANO_MEET_REPOSITORY_URL:-""} + if [[ $KOPANO_MEET_REPOSITORY_URL == http* ]]; then + version=$(curl -s -S -L "$KOPANO_MEET_REPOSITORY_URL"/Packages | grep -A2 "Package: kopano-meet-packages") + echo "${version##* }" + exit + fi + ;; kdav) git ls-remote --tags https://stash.kopano.io/scm/kc/kdav.git | awk -F/ '{ print $3 }' | tail -1 | sed 's/^.//' exit