diff --git a/.gitignore b/.gitignore index 40fe639..dcf0537 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,4 @@ *.yml docker-compose.yml data/* +env diff --git a/Makefile b/Makefile index ac3853f..0094ff0 100644 --- a/Makefile +++ b/Makefile @@ -9,13 +9,28 @@ core_download_version = $(shell ./version.sh core) webapp_version = $(shell docker run --rm $(docker_repo)/kopano_webapp cat /kopano/buildversion | tail -n 1 | grep -o -P '(?<=-).*(?=\+)') webapp_download_version = $(shell ./version.sh webapp) +KOPANO_CORE_REPOSITORY_URL := file:/kopano/repo/core +KOPANO_WEBAPP_REPOSITORY_URL := file:/kopano/repo/webapp +RELEASE_KEY_DOWNLOAD := 0 +DOWNLOAD_COMMUNITY_PACKAGES := 1 + +include env +export + +# convert lowercase componentname to uppercase COMPONENT = $(shell echo $(component) | tr a-z A-Z) build-all: build-ssl build-base build-core build-webapp build: component ?= base build: - docker build --build-arg KOPANO_$(COMPONENT)_VERSION=${$(component)_download_version} -t $(docker_repo)/kopano_$(component) $(component)/ + docker build \ + --build-arg KOPANO_$(COMPONENT)_VERSION=${$(component)_download_version} \ + --build-arg KOPANO_CORE_REPOSITORY_URL=$(KOPANO_CORE_REPOSITORY_URL) \ + --build-arg KOPANO_WEBAPP_REPOSITORY_URL=$(KOPANO_WEBAPP_REPOSITORY_URL) \ + --build-arg RELEASE_KEY_DOWNLOAD=$(RELEASE_KEY_DOWNLOAD) \ + --build-arg DOWNLOAD_COMMUNITY_PACKAGES=$(DOWNLOAD_COMMUNITY_PACKAGES) \ + -t $(docker_repo)/kopano_$(component) $(component)/ build-base: component=base make build diff --git a/README.md b/README.md index ed79dfd..73a4336 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,8 @@ New instructions: - explain Makefile -- `make docker_repo=kopano build-all` to upload to a custom docker hub account +- `make docker_repo=kopano publish` to upload to a custom docker hub account + ## Getting started with docker-compose diff --git a/env-example b/env-example new file mode 100644 index 0000000..98c4adf --- /dev/null +++ b/env-example @@ -0,0 +1,5 @@ +# modify below to build a different version, than the kopano nightly release +KOPANO_CORE_REPOSITORY_URL=https://serial:xxxx@download.kopano.io/supported/core:/final/Debian_9.0/ +KOPANO_WEBAPP_REPOSITORY_URL=https://serial:xxxx@download.kopano.io/supported/webapp:/final/Debian_9.0/ +RELEASE_KEY_DOWNLOAD=1 +DOWNLOAD_COMMUNITY_PACKAGES=0 diff --git a/version.sh b/version.sh index 9b3b911..5d9b402 100755 --- a/version.sh +++ b/version.sh @@ -8,6 +8,26 @@ source base/create-kopano-repo.sh component=${1:-core} +if [ -e ./env ]; then + source ./env +fi +KOPANO_CORE_REPOSITORY_URL=${KOPANO_CORE_REPOSITORY_URL:-""} +KOPANO_WEBAPP_REPOSITORY_URL=${KOPANO_WEBAPP_REPOSITORY_URL:-""} + +if [[ $KOPANO_CORE_REPOSITORY_URL == http* ]] || [[ $KOPANO_WEBAPP_REPOSITORY_URL == http* ]]; then + case $component in + core) + version=$(curl -s -S -L $KOPANO_CORE_REPOSITORY_URL/Packages | grep -A2 "Package: kopano-server-packages") + echo "${version##* }" + ;; + webapp) + version=$(curl -s -S -L $KOPANO_WEBAPP_REPOSITORY_URL/Packages | grep -m1 -A1 "Package: kopano-webapp") + echo "${version##* }" + ;; + esac + exit +fi + # query community server by h5ai API filename=$(h5ai_query "$component")