mirror of
				https://github.com/zokradonh/kopano-docker
				synced 2025-10-30 18:07:46 +00:00 
			
		
		
		
	Created another image for shared scripts.
This commit is contained in:
		
							parent
							
								
									954de3757e
								
							
						
					
					
						commit
						8ce7f2abdc
					
				
							
								
								
									
										54
									
								
								build.sh
									
									
									
									
									
								
							
							
						
						
									
										54
									
								
								build.sh
									
									
									
									
									
								
							| @ -9,7 +9,7 @@ serial="" | |||||||
| component="" | component="" | ||||||
| nocache="" | nocache="" | ||||||
| 
 | 
 | ||||||
| function urldecode() { : "${*//+/ }"; echo -e "${_//%/\\x}"; } | . ./common/common.sh | ||||||
| 
 | 
 | ||||||
| function _usage() | function _usage() | ||||||
| { | { | ||||||
| @ -23,7 +23,7 @@ function _usage() | |||||||
|     echo "-a   You can specify custom build args via e.g. -a ADDITIONAL_KOPANO_PACKAGES=kopano-migration-imap" |     echo "-a   You can specify custom build args via e.g. -a ADDITIONAL_KOPANO_PACKAGES=kopano-migration-imap" | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| while getopts ":s:c:b:p:n:a:i" opt; do | while getopts ":s:c:b:p:a:i" opt; do | ||||||
|     case $opt in |     case $opt in | ||||||
|         s) |         s) | ||||||
|             serial=$OPTARG |             serial=$OPTARG | ||||||
| @ -81,12 +81,9 @@ then | |||||||
| 
 | 
 | ||||||
|     # start build of supported kopano |     # start build of supported kopano | ||||||
|     # get current version to brand and tag the image correctly |     # get current version to brand and tag the image correctly | ||||||
|     currentVersion=$(curl -s -S -L https://serial:$serial@download.kopano.io/supported/$component:/$branch/Debian_9.0/Packages.gz |\ |     currentVersion=$(curl -s -S -L "https://serial:$serial@download.kopano.io/supported/$component:/$branch/Debian_9.0/Packages.gz" |\ | ||||||
|                         gzip -d | grep -A 8 "^Package: $mainpackage$" | awk '/Version/ { print $2 }') |                         gzip -d | grep -A 8 "^Package: $mainpackage$" | awk '/Version/ { print $2 }') | ||||||
| 
 | 
 | ||||||
|     currentVersionDocker=$(echo $currentVersion | sed 's/+/plus/') |  | ||||||
| 
 |  | ||||||
| 
 |  | ||||||
|     # webapp also needs core repository |     # webapp also needs core repository | ||||||
|     if [ "$component" == "webapp" ] |     if [ "$component" == "webapp" ] | ||||||
|     then |     then | ||||||
| @ -94,49 +91,48 @@ then | |||||||
|     fi |     fi | ||||||
| 
 | 
 | ||||||
|     echo "Start building supported kopano $component image version ($currentVersion)..." |     echo "Start building supported kopano $component image version ($currentVersion)..." | ||||||
| 
 |     set -x | ||||||
|     # build it |     # build it | ||||||
|     docker build --build-arg KOPANO_${component^^}_REPOSITORY_URL=https://serial:$serial@download.kopano.io/supported/$component:/$branch/Debian_9.0 \ |     if docker build \ | ||||||
|  |                  --pull \ | ||||||
|  |                  --build-arg "KOPANO_${component^^}_REPOSITORY_URL=https://serial:$serial@download.kopano.io/supported/$component:/$branch/Debian_9.0" \ | ||||||
|                  --build-arg RELEASE_KEY_DOWNLOAD=1 \ |                  --build-arg RELEASE_KEY_DOWNLOAD=1 \ | ||||||
|                  --build-arg DOWNLOAD_COMMUNITY_PACKAGES=0 \ |                  --build-arg "DOWNLOAD_COMMUNITY_PACKAGES=0" \ | ||||||
|                  --build-arg KOPANO_${component^^}_VERSION=$currentVersion \ |                  --build-arg "KOPANO_${component^^}_VERSION=$currentVersion" \ | ||||||
|                  -t zokradonh/kopano_$component:$currentVersionDocker \ |                  -t "zokradonh/kopano_$component:${currentVersion//+/plus}" \ | ||||||
|                  -t zokradonh/kopano_$component:latest-$branch \ |                  -t "zokradonh/kopano_$component:latest-$branch" \ | ||||||
|                  $nocache \ |                  $nocache \ | ||||||
|                  $customBuildString \ |                  $customBuildString \ | ||||||
|                  ${buildcontext_base}${component} |                  "${buildcontext_base}${component}" | ||||||
|     if [ $? -eq 0 ] |  | ||||||
|     then  |     then  | ||||||
|  |         set +x | ||||||
|         echo "Please note that this image does include your serial. If you publish this image then your serial is exposed to public." |         echo "Please note that this image does include your serial. If you publish this image then your serial is exposed to public." | ||||||
|     fi |     fi | ||||||
| else | else | ||||||
|     # start build of community kopano |     # start build of community kopano | ||||||
| 
 | 
 | ||||||
|     hash jq > /dev/null |      | ||||||
|     if [ $? -ne 0 ] |     if ! hash jq | ||||||
|     then |     then | ||||||
|         echo "Please install jq in order to run this build script." |         echo "Please install jq in order to run this build script." | ||||||
|         exit 1 |         exit 1 | ||||||
|     fi |     fi | ||||||
| 
 | 
 | ||||||
|     # query community server by h5ai API |     # query community server by h5ai API | ||||||
|     filename=$(curl -s -S -L -d "action=get&items%5Bhref%5D=%2Fcommunity%2F$component%3A%2F&items%5Bwhat%5D=1" -H \ |     filename=$(h5ai_query "$component") | ||||||
|                     "Accept: application/json" https://download.kopano.io/community/ | jq '.items[].href' | \ |  | ||||||
|                     grep Debian_9.0-a | sed 's#"##g' | sed "s#/community/$component:/##") |  | ||||||
| 
 | 
 | ||||||
|     filename=$(urldecode $filename) |     currentVersion=$(version_from_filename "$filename") | ||||||
| 
 |  | ||||||
|     currentVersion=$(echo $filename | sed -r 's#[a-z]+-([0-9_.+]+)-.*#\1#') |  | ||||||
|     currentVersionDocker=$(echo $currentVersion | sed 's/+/plus/') |  | ||||||
| 
 | 
 | ||||||
|     echo "Start building community kopano $component image version ($currentVersion)..." |     echo "Start building community kopano $component image version ($currentVersion)..." | ||||||
| 
 |     set -x | ||||||
|     # build it |     # build it | ||||||
|     docker build -t zokradonh/kopano_$component:$currentVersionDocker \ |     docker build --pull \ | ||||||
|                  -t zokradonh/kopano_$component:latest-$branch \ |                  -t "zokradonh/kopano_$component:${currentVersion//+/plus}" \ | ||||||
|                  -t zokradonh/kopano_$component:latest \ |                  -t "zokradonh/kopano_$component:latest-$branch" \ | ||||||
|                  --build-arg KOPANO_${component^^}_VERSION=$currentVersion \ |                  -t "zokradonh/kopano_$component:latest" \ | ||||||
|  |                  --build-arg "KOPANO_${component^^}_VERSION=$currentVersion" \ | ||||||
|                  $nocache \ |                  $nocache \ | ||||||
|                  $customBuildString \ |                  $customBuildString \ | ||||||
|                  ${buildcontext_base}${component} |                  "${buildcontext_base}${component}" | ||||||
|  |     set +x | ||||||
| fi | fi | ||||||
							
								
								
									
										3
									
								
								common/Dockerfile
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										3
									
								
								common/Dockerfile
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,3 @@ | |||||||
|  | FROM scratch | ||||||
|  | 
 | ||||||
|  | COPY common.sh / | ||||||
							
								
								
									
										49
									
								
								common/common.sh
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										49
									
								
								common/common.sh
									
									
									
									
									
										Executable file
									
								
							| @ -0,0 +1,49 @@ | |||||||
|  | #!/bin/bash | ||||||
|  | 
 | ||||||
|  | set -eu | ||||||
|  | 
 | ||||||
|  | function urldecode { : "${*//+/ }"; echo -e "${_//%/\\x}"; } | ||||||
|  | 
 | ||||||
|  | function version_from_filename { | ||||||
|  |     echo "$1" | sed -r 's#[a-z]+-([0-9_.+]+)-.*#\1#' | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | function h5ai_query { | ||||||
|  |     filename=$(curl -s -S -L -d "action=get&items%5Bhref%5D=%2Fcommunity%2F$1%3A%2F&items%5Bwhat%5D=1" -H \ | ||||||
|  |                 "Accept: application/json" https://download.kopano.io/community/ | jq '.items[].href' | \ | ||||||
|  |                 grep 'Debian_9.0-all\|Debian_9.0-amd64' | sed 's#"##g' | sed "s#/community/$1:/##") | ||||||
|  | 
 | ||||||
|  |     if [ -z "${filename// }" ]; then | ||||||
|  |         echo "unknown component" | ||||||
|  |         exit 1 | ||||||
|  |     fi | ||||||
|  | 
 | ||||||
|  |     filename=$(urldecode "$filename") | ||||||
|  |     echo "$filename" | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | function dl_and_package_community { | ||||||
|  |     # take component as first argument and fallback to core if none given | ||||||
|  |     component=${1:-core} | ||||||
|  | 
 | ||||||
|  |     # query community server by h5ai API | ||||||
|  |     filename=$(h5ai_query "$component") | ||||||
|  | 
 | ||||||
|  |     # download & extract packages | ||||||
|  |     curl -s -S -L -o "$filename" https://download.kopano.io/community/"$component":/"${filename}" | ||||||
|  |     tar xf "$filename" | ||||||
|  | 
 | ||||||
|  |     # save buildversion | ||||||
|  |     currentVersion=$(version_from_filename "$filename") | ||||||
|  |     echo "$component-$currentVersion" >> /kopano/buildversion | ||||||
|  | 
 | ||||||
|  |     # save disk space | ||||||
|  |     rm "$filename" | ||||||
|  | 
 | ||||||
|  |     mv "${filename%.tar.gz}" "$component" | ||||||
|  | 
 | ||||||
|  |     # prepare directory to be apt source | ||||||
|  |     cd "$component" | ||||||
|  |     apt-ftparchive packages . | gzip -9c > Packages.gz | ||||||
|  |     cd ".." | ||||||
|  | } | ||||||
| @ -1,9 +1,11 @@ | |||||||
|  | FROM zokradonh/kopano_common AS common | ||||||
|  | 
 | ||||||
| FROM debian:stretch | FROM debian:stretch | ||||||
| 
 | 
 | ||||||
| LABEL maintainer=az@zok.xyz \ | LABEL maintainer=az@zok.xyz \ | ||||||
|       version="2.0" |       version="2.0" | ||||||
| 
 | 
 | ||||||
| RUN mkdir -p /kopano/repo /kopano/data | RUN mkdir -p /kopano/repo /kopano/data /kopano/helper | ||||||
| WORKDIR /kopano/repo | WORKDIR /kopano/repo | ||||||
| 
 | 
 | ||||||
| ARG DEBIAN_FRONTEND=noninteractive | ARG DEBIAN_FRONTEND=noninteractive | ||||||
| @ -29,29 +31,40 @@ RUN sed -i -e 's/# en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/' /etc/locale.gen && \ | |||||||
|     update-locale LANG=en_US.UTF-8 |     update-locale LANG=en_US.UTF-8 | ||||||
| 
 | 
 | ||||||
| ARG KOPANO_CORE_VERSION=newest | ARG KOPANO_CORE_VERSION=newest | ||||||
| ARG KOPANO_CORE_REPOSITORY_URL="file:/kopano/repo" | ARG KOPANO_CORE_REPOSITORY_URL="file:/kopano/repo/core" | ||||||
| ARG KOPANO_REPOSITORY_FLAGS="trusted=yes" | ARG KOPANO_REPOSITORY_FLAGS="trusted=yes" | ||||||
| ARG DOWNLOAD_COMMUNITY_PACKAGES=1 | ARG DOWNLOAD_COMMUNITY_PACKAGES=1 | ||||||
| ARG RELEASE_KEY_DOWNLOAD=0 | ARG RELEASE_KEY_DOWNLOAD=0 | ||||||
| ARG ADDITIONAL_KOPANO_PACKAGES | ARG ADDITIONAL_KOPANO_PACKAGES="" | ||||||
| 
 | 
 | ||||||
| # community build | # get common utilities | ||||||
| COPY download_community.sh /kopano/download_community.sh | COPY --from=common /common.sh /kopano/helper/ | ||||||
|  | 
 | ||||||
|  | SHELL [ "/bin/bash", "-c"] | ||||||
| 
 | 
 | ||||||
| RUN \ | RUN \ | ||||||
|     # community download |     # community download and package as apt source repository | ||||||
|     [ ${DOWNLOAD_COMMUNITY_PACKAGES} -eq 1 ] && \ |     . /kopano/helper/common.sh && \ | ||||||
|     /kopano/download_community.sh core && \ |     if [ ${DOWNLOAD_COMMUNITY_PACKAGES} -eq 1 ]; then \ | ||||||
|  |         dl_and_package_community "core"; \ | ||||||
|  |     fi; \ | ||||||
|  |     echo "deb [${KOPANO_REPOSITORY_FLAGS}] ${KOPANO_CORE_REPOSITORY_URL} ./" > /etc/apt/sources.list.d/kopano.list; \ | ||||||
|  |     # save kopano version if supported kopano | ||||||
|  |     if [ -z /kopano/buildversion ]; then \ | ||||||
|  |         echo "core-${KOPANO_CORE_VERSION}" > /kopano/buildversion; \ | ||||||
|  |     fi; \ | ||||||
|  |     # install apt key if supported kopano | ||||||
|  |     if [ ${RELEASE_KEY_DOWNLOAD} -eq 1 ]; then \ | ||||||
|  |         curl -s -S -o - "${KOPANO_CORE_REPOSITORY_URL}/Release.key" | apt-key add -; \ | ||||||
|  |     fi; \ | ||||||
|     # install |     # install | ||||||
|     set -x && \ |  | ||||||
|     echo ${KOPANO_CORE_VERSION} > /kopano/buildversion && \ |  | ||||||
|     echo "deb [${KOPANO_REPOSITORY_FLAGS}] ${KOPANO_CORE_REPOSITORY_URL} ./" > /etc/apt/sources.list.d/kopano-core.list; \ |  | ||||||
|     [ ${RELEASE_KEY_DOWNLOAD} -eq 1 ] && curl -s -S -o - "${KOPANO_CORE_REPOSITORY_URL}/Release.key" | apt-key add -; \ |  | ||||||
|     apt-get update && \ |     apt-get update && \ | ||||||
|  |     set -x && \ | ||||||
|     apt-get install --no-install-recommends -y \ |     apt-get install --no-install-recommends -y \ | ||||||
|         kopano-server-packages \ |         kopano-server-packages \ | ||||||
|         ${ADDITIONAL_KOPANO_PACKAGES} \ |         ${ADDITIONAL_KOPANO_PACKAGES} \ | ||||||
|         php7.0-cli && \ |         php7.0-cli && \ | ||||||
|  |     set +x && \ | ||||||
|     rm -rf /var/cache/apt /var/lib/apt/lists && \ |     rm -rf /var/cache/apt /var/lib/apt/lists && \ | ||||||
|     cp /usr/share/doc/kopano/example-config/*.cfg /etc/kopano/ && \ |     cp /usr/share/doc/kopano/example-config/*.cfg /etc/kopano/ && \ | ||||||
|     cp /usr/share/doc/kopano/example-config/*.cfg.gz /etc/kopano/ && \ |     cp /usr/share/doc/kopano/example-config/*.cfg.gz /etc/kopano/ && \ | ||||||
| @ -64,7 +77,6 @@ ENV LANG=en_US.UTF-8 | |||||||
| ENV SERVICE_TO_START=server | ENV SERVICE_TO_START=server | ||||||
| 
 | 
 | ||||||
| COPY kcconf.py defaultconfigs/ start-service.sh /kopano/ | COPY kcconf.py defaultconfigs/ start-service.sh /kopano/ | ||||||
| RUN chmod a+x /kopano/start-service.sh |  | ||||||
| 
 | 
 | ||||||
| ENTRYPOINT ["/usr/bin/dumb-init", "--"] | ENTRYPOINT ["/usr/bin/dumb-init", "--"] | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -1,29 +0,0 @@ | |||||||
| #!/bin/bash |  | ||||||
| 
 |  | ||||||
| # take component as first argument and fallback to core if none given |  | ||||||
| component=${1:-core} |  | ||||||
| 
 |  | ||||||
| function urldecode() { : "${*//+/ }"; echo -e "${_//%/\\x}"; } |  | ||||||
| 
 |  | ||||||
| # query community server by h5ai API |  | ||||||
| filename=$(curl -s -S -L -d "action=get&items%5Bhref%5D=%2Fcommunity%2F$component%3A%2F&items%5Bwhat%5D=1" -H \ |  | ||||||
|                 "Accept: application/json" https://download.kopano.io/community/ | jq '.items[].href' | \ |  | ||||||
|                 grep 'Debian_9.0-all\|Debian_9.0-amd64' | sed 's#"##g' | sed "s#/community/$component:/##") |  | ||||||
| 
 |  | ||||||
| if [ -z "${filename// }" ]; then |  | ||||||
| 	echo "unknown component" |  | ||||||
| 	exit 1 |  | ||||||
| fi |  | ||||||
| 
 |  | ||||||
| filename=$(urldecode "$filename") |  | ||||||
| 
 |  | ||||||
| # download & extract packages |  | ||||||
| curl -s -S -L -o "$filename" https://download.kopano.io/community/"$component":/"${filename}" |  | ||||||
| 
 |  | ||||||
| tar xf "$filename" |  | ||||||
| 
 |  | ||||||
| # save disk space |  | ||||||
| rm "$filename" |  | ||||||
| 
 |  | ||||||
| # prepare directory to be apt source |  | ||||||
| apt-ftparchive packages "${filename%.tar.gz}" | gzip -9c > Packages.gz |  | ||||||
							
								
								
									
										0
									
								
								core/start-service.sh
									
									
									
									
									
										
										
										Normal file → Executable file
									
								
							
							
						
						
									
										0
									
								
								core/start-service.sh
									
									
									
									
									
										
										
										Normal file → Executable file
									
								
							| @ -1,29 +0,0 @@ | |||||||
| #!/bin/bash |  | ||||||
| 
 |  | ||||||
| # take component as first argument and fallback to core if none given |  | ||||||
| component=${1:-core} |  | ||||||
| 
 |  | ||||||
| function urldecode() { : "${*//+/ }"; echo -e "${_//%/\\x}"; } |  | ||||||
| 
 |  | ||||||
| # query community server by h5ai API |  | ||||||
| filename=$(curl -s -S -L -d "action=get&items%5Bhref%5D=%2Fcommunity%2F$component%3A%2F&items%5Bwhat%5D=1" -H \ |  | ||||||
|                 "Accept: application/json" https://download.kopano.io/community/ | jq '.items[].href' | \ |  | ||||||
|                 grep 'Debian_9.0-all\|Debian_9.0-amd64' | sed 's#"##g' | sed "s#/community/$component:/##") |  | ||||||
| 
 |  | ||||||
| if [ -z "${filename// }" ]; then |  | ||||||
| 	echo "unknown component" |  | ||||||
| 	exit 1 |  | ||||||
| fi |  | ||||||
| 
 |  | ||||||
| filename=$(urldecode "$filename") |  | ||||||
| 
 |  | ||||||
| # download & extract packages |  | ||||||
| curl -s -S -L -o "$filename" https://download.kopano.io/community/"$component":/"${filename}" |  | ||||||
| 
 |  | ||||||
| tar xf "$filename" |  | ||||||
| 
 |  | ||||||
| # save disk space |  | ||||||
| rm "$filename" |  | ||||||
| 
 |  | ||||||
| # prepare directory to be apt source |  | ||||||
| apt-ftparchive packages "${filename%.tar.gz}" | gzip -9c > Packages.gz |  | ||||||
| @ -1,12 +1,14 @@ | |||||||
|  | FROM zokradonh/kopano_common AS common | ||||||
|  | 
 | ||||||
| FROM debian:stretch | FROM debian:stretch | ||||||
| 
 | 
 | ||||||
| LABEL maintainer=az@zok.xyz \ | LABEL maintainer=az@zok.xyz \ | ||||||
|       version="2.0" |       version="2.0" | ||||||
| 
 | 
 | ||||||
| RUN mkdir -p /kopano/repo /kopano/data | RUN mkdir -p /kopano/repo /kopano/data /kopano/helper | ||||||
| WORKDIR /kopano/repo | WORKDIR /kopano/repo | ||||||
| 
 | 
 | ||||||
| ENV DEBIAN_FRONTEND noninteractive | ARG DEBIAN_FRONTEND=noninteractive | ||||||
| 
 | 
 | ||||||
| # install basics | # install basics | ||||||
| RUN apt-get update && \ | RUN apt-get update && \ | ||||||
| @ -25,40 +27,44 @@ RUN apt-get update && \ | |||||||
|         && \ |         && \ | ||||||
|     rm -rf /var/cache/apt /var/lib/apt/lists |     rm -rf /var/cache/apt /var/lib/apt/lists | ||||||
| 
 | 
 | ||||||
| # If you have active Kopano subscription you can change KOPANO_WEBAPP_REPOSITORY_URL to |  | ||||||
| # https://serial:<YOURSERIAL>@download.kopano.io/supported/webapp:/final/Debian_9.0 |  | ||||||
| # and replace <YOURSERIAL> with your serial. You can also use pre-final or any other repository branch. |  | ||||||
| # docker build --build-arg KOPANO_WEBAPP_REPOSITORY_URL=https://serial:<YOURSERIAL>@download.kopano.io/supported/webapp:/final/Debian_9.0 https://github.com/zokradonh/kopano-docker.git#:webapp |  | ||||||
| # Do the same with KOPANO_CORE_REPOSITORY as webapp needs some packages from core. |  | ||||||
| # If you want to use community version please use images from hub.docker.com. |  | ||||||
| # Changing KOPANO_WEBAPP_VERSION does not really change the resulting image. |  | ||||||
| ARG KOPANO_WEBAPP_VERSION=newest | ARG KOPANO_WEBAPP_VERSION=newest | ||||||
| ARG KOPANO_WEBAPP_REPOSITORY_URL="file:/kopano/repo" | ARG KOPANO_WEBAPP_REPOSITORY_URL="file:/kopano/repo/webapp" | ||||||
| ARG KOPANO_CORE_REPOSITORY_URL="file:/kopano/repo" | ARG KOPANO_CORE_REPOSITORY_URL="file:/kopano/repo/core" | ||||||
| ARG KOPANO_REPOSITORY_FLAGS="trusted=yes" | ARG KOPANO_REPOSITORY_FLAGS="trusted=yes" | ||||||
| ARG DOWNLOAD_COMMUNITY_PACKAGES=1 | ARG DOWNLOAD_COMMUNITY_PACKAGES=1 | ||||||
| ARG RELEASE_KEY_DOWNLOAD=0 | ARG RELEASE_KEY_DOWNLOAD=0 | ||||||
| ARG ADDITIONAL_KOPANO_PACKAGES | ARG ADDITIONAL_KOPANO_PACKAGES="" | ||||||
| 
 | 
 | ||||||
| # community build | # get common utilities | ||||||
| COPY download_community.sh /kopano/download_community.sh | COPY --from=common /common.sh /kopano/helper/ | ||||||
|  | 
 | ||||||
|  | SHELL [ "/bin/bash", "-c"] | ||||||
| 
 | 
 | ||||||
| # install kopano web app and refresh ca-certificates | # install kopano web app and refresh ca-certificates | ||||||
| RUN \ | RUN \ | ||||||
|     # community download |     # community download and package as apt source repository | ||||||
|     [ ${DOWNLOAD_COMMUNITY_PACKAGES} -eq 1 ] && \ |     . /kopano/helper/common.sh && \ | ||||||
|     /kopano/download_community.sh core && \ |     if [ ${DOWNLOAD_COMMUNITY_PACKAGES} -eq 1 ]; then \ | ||||||
|     /kopano/download_community.sh webapp && \ |         dl_and_package_community "core"; \ | ||||||
|     # install |         dl_and_package_community "webapp"; \ | ||||||
|     set -x && \ |     fi; \ | ||||||
|     echo ${KOPANO_CORE_VERSION} > /kopano/buildversion && \ |     echo "deb [${KOPANO_REPOSITORY_FLAGS}] ${KOPANO_CORE_REPOSITORY_URL} ./" > /etc/apt/sources.list.d/kopano.list; \ | ||||||
|     echo ${KOPANO_WEBAPP_VERSION} >> /kopano/buildversion && \ |     echo "deb [${KOPANO_REPOSITORY_FLAGS}] ${KOPANO_WEBAPP_REPOSITORY_URL} ./" >> /etc/apt/sources.list.d/kopano.list; \ | ||||||
|     echo "deb [${KOPANO_REPOSITORY_FLAGS}] ${KOPANO_CORE_REPOSITORY_URL} ./" > /etc/apt/sources.list.d/kopano-core.list; \ |     # save kopano version if supported kopano | ||||||
|     [ ${DOWNLOAD_COMMUNITY_PACKAGES} -eq 0 ] && echo "deb [${KOPANO_REPOSITORY_FLAGS}] ${KOPANO_WEBAPP_REPOSITORY_URL} ./" > /etc/apt/sources.list.d/kopano-webapp.list; \ |     if [ -z /kopano/buildversion ]; then \ | ||||||
|     [ ${RELEASE_KEY_DOWNLOAD} -eq 1 ] && curl -s -S -o - "${KOPANO_CORE_REPOSITORY_URL}/Release.key" | apt-key add -; \ |         echo "core-${KOPANO_CORE_VERSION}" > /kopano/buildversion; \ | ||||||
|     [ ${RELEASE_KEY_DOWNLOAD} -eq 1 ] && curl -s -S -o - "${KOPANO_WEBAPP_REPOSITORY_URL}/Release.key" | apt-key add -; \ |         echo "webapp-${KOPANO_WEBAPP_VERSION}" >> /kopano/buildversion; \ | ||||||
|  |     fi; \ | ||||||
|  |     # install apt keys if supported kopano | ||||||
|  |     if [ ${RELEASE_KEY_DOWNLOAD} -eq 1 ]; then \ | ||||||
|  |         curl -s -S -o - "${KOPANO_CORE_REPOSITORY_URL}/Release.key" | apt-key add -; \ | ||||||
|  |         curl -s -S -o - "${KOPANO_WEBAPP_REPOSITORY_URL}/Release.key" | apt-key add -; \ | ||||||
|  |     fi; \ | ||||||
|  |     # prepare z-push installation | ||||||
|     echo "deb http://repo.z-hub.io/z-push:/final/Debian_9.0/ /" > /etc/apt/sources.list.d/zpush.list && \ |     echo "deb http://repo.z-hub.io/z-push:/final/Debian_9.0/ /" > /etc/apt/sources.list.d/zpush.list && \ | ||||||
|     curl -s -S -o - "http://repo.z-hub.io/z-push:/final/Debian_9.0/Release.key" | apt-key add - && \ |     curl -s -S -o - "http://repo.z-hub.io/z-push:/final/Debian_9.0/Release.key" | apt-key add - && \ | ||||||
|  |     # install | ||||||
|  |     set -x && \ | ||||||
|     apt-get update && apt-get install -y --no-install-recommends \ |     apt-get update && apt-get install -y --no-install-recommends \ | ||||||
|         apache2 \ |         apache2 \ | ||||||
|         libapache2-mod-php7.0 \ |         libapache2-mod-php7.0 \ | ||||||
| @ -131,8 +137,6 @@ EXPOSE 80/tcp | |||||||
| 
 | 
 | ||||||
| COPY start.sh /kopano/start.sh | COPY start.sh /kopano/start.sh | ||||||
| 
 | 
 | ||||||
| RUN chmod a+x /kopano/start.sh |  | ||||||
| 
 |  | ||||||
| ENV LANG en_US.UTF-8 | ENV LANG en_US.UTF-8 | ||||||
| 
 | 
 | ||||||
| ENTRYPOINT ["/usr/bin/dumb-init", "--"] | ENTRYPOINT ["/usr/bin/dumb-init", "--"] | ||||||
|  | |||||||
| @ -1,29 +0,0 @@ | |||||||
| #!/bin/bash |  | ||||||
| 
 |  | ||||||
| # take component as first argument and fallback to core if none given |  | ||||||
| component=${1:-core} |  | ||||||
| 
 |  | ||||||
| function urldecode() { : "${*//+/ }"; echo -e "${_//%/\\x}"; } |  | ||||||
| 
 |  | ||||||
| # query community server by h5ai API |  | ||||||
| filename=$(curl -s -S -L -d "action=get&items%5Bhref%5D=%2Fcommunity%2F$component%3A%2F&items%5Bwhat%5D=1" -H \ |  | ||||||
|                 "Accept: application/json" https://download.kopano.io/community/ | jq '.items[].href' | \ |  | ||||||
|                 grep 'Debian_9.0-all\|Debian_9.0-amd64' | sed 's#"##g' | sed "s#/community/$component:/##") |  | ||||||
| 
 |  | ||||||
| if [ -z "${filename// }" ]; then |  | ||||||
| 	echo "unknown component" |  | ||||||
| 	exit 1 |  | ||||||
| fi |  | ||||||
| 
 |  | ||||||
| filename=$(urldecode "$filename") |  | ||||||
| 
 |  | ||||||
| # download & extract packages |  | ||||||
| curl -s -S -L -o "$filename" https://download.kopano.io/community/"$component":/"${filename}" |  | ||||||
| 
 |  | ||||||
| tar xf "$filename" |  | ||||||
| 
 |  | ||||||
| # save disk space |  | ||||||
| rm "$filename" |  | ||||||
| 
 |  | ||||||
| # prepare directory to be apt source |  | ||||||
| apt-ftparchive packages "${filename%.tar.gz}" | gzip -9c > Packages.gz |  | ||||||
							
								
								
									
										0
									
								
								webapp/start.sh
									
									
									
									
									
										
										
										Normal file → Executable file
									
								
							
							
						
						
									
										0
									
								
								webapp/start.sh
									
									
									
									
									
										
										
										Normal file → Executable file
									
								
							
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user