mirror of
https://github.com/zokradonh/kopano-docker.git
synced 2026-08-11 16:32:59 +00:00
Created another image for shared scripts.
This commit is contained in:
+25
-13
@@ -1,9 +1,11 @@
|
||||
FROM zokradonh/kopano_common AS common
|
||||
|
||||
FROM debian:stretch
|
||||
|
||||
LABEL maintainer=az@zok.xyz \
|
||||
version="2.0"
|
||||
|
||||
RUN mkdir -p /kopano/repo /kopano/data
|
||||
RUN mkdir -p /kopano/repo /kopano/data /kopano/helper
|
||||
WORKDIR /kopano/repo
|
||||
|
||||
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
|
||||
|
||||
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 DOWNLOAD_COMMUNITY_PACKAGES=1
|
||||
ARG RELEASE_KEY_DOWNLOAD=0
|
||||
ARG ADDITIONAL_KOPANO_PACKAGES
|
||||
ARG ADDITIONAL_KOPANO_PACKAGES=""
|
||||
|
||||
# community build
|
||||
COPY download_community.sh /kopano/download_community.sh
|
||||
# get common utilities
|
||||
COPY --from=common /common.sh /kopano/helper/
|
||||
|
||||
SHELL [ "/bin/bash", "-c"]
|
||||
|
||||
RUN \
|
||||
# community download
|
||||
[ ${DOWNLOAD_COMMUNITY_PACKAGES} -eq 1 ] && \
|
||||
/kopano/download_community.sh core && \
|
||||
# community download and package as apt source repository
|
||||
. /kopano/helper/common.sh && \
|
||||
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
|
||||
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 && \
|
||||
set -x && \
|
||||
apt-get install --no-install-recommends -y \
|
||||
kopano-server-packages \
|
||||
${ADDITIONAL_KOPANO_PACKAGES} \
|
||||
php7.0-cli && \
|
||||
set +x && \
|
||||
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.gz /etc/kopano/ && \
|
||||
@@ -64,7 +77,6 @@ ENV LANG=en_US.UTF-8
|
||||
ENV SERVICE_TO_START=server
|
||||
|
||||
COPY kcconf.py defaultconfigs/ start-service.sh /kopano/
|
||||
RUN chmod a+x /kopano/start-service.sh
|
||||
|
||||
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
|
||||
Regular → Executable
Reference in New Issue
Block a user