mirror of
				https://github.com/zokradonh/kopano-docker
				synced 2025-10-31 10:27:14 +00:00 
			
		
		
		
	Makefile tweaks (#329)
* add --rm to build commands to prevent dangling images relates to https://github.com/Kopano-dev/kopano-docker/pull/11 * remove login from makefile * add docker login to travis instead * readme tweaks
This commit is contained in:
		
							parent
							
								
									cdd88b9d11
								
							
						
					
					
						commit
						f8b14c6a98
					
				| @ -30,6 +30,7 @@ deploy: | |||||||
|   - provider: script |   - provider: script | ||||||
|     skip-cleanup: true |     skip-cleanup: true | ||||||
|     script: |     script: | ||||||
|  |       - echo "$docker_pwd" | docker login -u "$docker_login" --password-stdin | ||||||
|       - make publish |       - make publish | ||||||
|     on: |     on: | ||||||
|       branch: master |       branch: master | ||||||
|  | |||||||
							
								
								
									
										18
									
								
								Makefile
									
									
									
									
									
								
							
							
						
						
									
										18
									
								
								Makefile
									
									
									
									
									
								
							| @ -7,11 +7,6 @@ MAKEFLAGS += --warn-undefined-variables | |||||||
| MAKEFLAGS += --no-builtin-rules | MAKEFLAGS += --no-builtin-rules | ||||||
| 
 | 
 | ||||||
| docker_repo := zokradonh | 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) | base_download_version := $(shell ./version.sh core) | ||||||
| core_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)" | 	@echo "fetching previous build to warm up build cache (only on travis)" | ||||||
| 	docker pull  $(docker_repo)/kopano_$(component):builder || true | 	docker pull  $(docker_repo)/kopano_$(component):builder || true | ||||||
| endif | endif | ||||||
| 	docker build \
 | 	docker build --rm \
 | ||||||
| 		--build-arg VCS_REF=$(vcs_ref) \
 | 		--build-arg VCS_REF=$(vcs_ref) \
 | ||||||
| 		--build-arg docker_repo=${docker_repo} \
 | 		--build-arg docker_repo=${docker_repo} \
 | ||||||
| 		--build-arg KOPANO_CORE_VERSION=${core_download_version} \
 | 		--build-arg KOPANO_CORE_VERSION=${core_download_version} \
 | ||||||
| @ -82,7 +77,7 @@ endif | |||||||
| .PHONY: build-simple | .PHONY: build-simple | ||||||
| build-simple: component ?= ssl | build-simple: component ?= ssl | ||||||
| build-simple: ## Helper target to build a simplified image (no Kopano repo integration).
 | 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 VCS_REF=$(vcs_ref) \
 | ||||||
| 		--build-arg docker_repo=$(docker_repo) \
 | 		--build-arg docker_repo=$(docker_repo) \
 | ||||||
| 		--cache-from $(docker_repo)/kopano_$(component):latest \
 | 		--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)" | 	@echo "fetching previous build to warm up build cache (only on travis)" | ||||||
| 	docker pull  $(docker_repo)/kopano_$(component):builder || true | 	docker pull  $(docker_repo)/kopano_$(component):builder || true | ||||||
| endif | endif | ||||||
| 	docker build --target builder \
 | 	docker build --rm \
 | ||||||
|  | 		--target builder \
 | ||||||
| 		--build-arg VCS_REF=$(vcf_ref) \
 | 		--build-arg VCS_REF=$(vcf_ref) \
 | ||||||
| 		--build-arg docker_repo=${docker_repo} \
 | 		--build-arg docker_repo=${docker_repo} \
 | ||||||
| 		--build-arg KOPANO_CORE_VERSION=${core_download_version} \
 | 		--build-arg KOPANO_CORE_VERSION=${core_download_version} \
 | ||||||
| @ -170,7 +166,7 @@ build-webapp: | |||||||
| 	component=webapp make build | 	component=webapp make build | ||||||
| 
 | 
 | ||||||
| build-webapp-demo: ## Replaces the actual kopano_webapp container with one that has login hints for demo.kopano.com.
 | 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 \
 | 		-f webapp/Dockerfile.demo \
 | ||||||
| 		-t $(docker_repo)/kopano_webapp webapp/ | 		-t $(docker_repo)/kopano_webapp webapp/ | ||||||
| 
 | 
 | ||||||
| @ -267,11 +263,9 @@ tag-zpush: | |||||||
| 	component=zpush make tag-container | 	component=zpush make tag-container | ||||||
| 
 | 
 | ||||||
| # Docker publish
 | # Docker publish
 | ||||||
| repo-login: ## Login at hub.docker.com
 |  | ||||||
| 	@echo $(docker_pwd) | docker login -u $(docker_login) --password-stdin |  | ||||||
| 
 | 
 | ||||||
| .PHONY: publish | .PHONY: publish | ||||||
| publish: repo-login | publish: | ||||||
| 	make $(shell grep -o ^publish-.*: Makefile | grep -Ev 'publish-container' | uniq | sed s/://g | xargs) | 	make $(shell grep -o ^publish-.*: Makefile | grep -Ev 'publish-container' | uniq | sed s/://g | xargs) | ||||||
| 
 | 
 | ||||||
| publish-container: component ?= base | publish-container: component ?= base | ||||||
|  | |||||||
| @ -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 | ### 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` | - Get a status overview of the running containers: `docker-compose ps` | ||||||
| - Stop compose running in the background: `docker-compose stop` | - Stop compose running in the background: `docker-compose stop` | ||||||
| - Destroy local containers and network interfaces: `docker-compose down` | - 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` | - 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` | - 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` | - 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) | - 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 | ## Third party docker images | ||||||
|  | |||||||
| @ -63,14 +63,13 @@ zpush) | |||||||
| 	fi | 	fi | ||||||
| 	;; | 	;; | ||||||
| meet) | meet) | ||||||
| 	KOPANO_CORE_REPOSITORY_URL=${KOPANO_MEET_REPOSITORY_URL:-""} | 	KOPANO_MEET_REPOSITORY_URL=${KOPANO_MEET_REPOSITORY_URL:-""} | ||||||
| 	if [[ $KOPANO_MEET_REPOSITORY_URL == http* ]]; then | 	if [[ $KOPANO_MEET_REPOSITORY_URL == http* ]]; then | ||||||
| 		version=$(curl -s -S -L "$KOPANO_MEET_REPOSITORY_URL"/Packages | grep -A2 "Package: kopano-meet-packages") | 		version=$(curl -s -S -L "$KOPANO_MEET_REPOSITORY_URL"/Packages | grep -A2 "Package: kopano-meet-packages") | ||||||
| 		echo "${version##* }" | 		echo "${version##* }" | ||||||
| 		exit | 		exit | ||||||
| 	fi | 	fi | ||||||
| 	;; | 	;; | ||||||
| 
 |  | ||||||
| kdav) | kdav) | ||||||
| 	git ls-remote --tags https://stash.kopano.io/scm/kc/kdav.git | awk -F/ '{ print $3 }' | tail -1 | sed 's/^.//' | 	git ls-remote --tags https://stash.kopano.io/scm/kc/kdav.git | awk -F/ '{ print $3 }' | tail -1 | sed 's/^.//' | ||||||
| 	exit | 	exit | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user