mirror of
https://github.com/zokradonh/kopano-docker.git
synced 2026-08-11 16:32:59 +00:00
add makefile
add example docker-compose (for easy copy and paste) refactor common multi stage image to base image for core and webapp add docker version tagging add a version to the base image as well Signed-off-by: Felix Bartels <felix@host-consultants.de>
This commit is contained in:
@@ -0,0 +1,47 @@
|
||||
FROM debian:stretch
|
||||
|
||||
LABEL maintainer=az@zok.xyz \
|
||||
version="2.0"
|
||||
|
||||
RUN mkdir -p /kopano/repo /kopano/data /kopano/helper
|
||||
WORKDIR /kopano/repo
|
||||
|
||||
ARG DEBIAN_FRONTEND=noninteractive
|
||||
|
||||
# install basics
|
||||
# TODO require python3 or python3-minimal?
|
||||
RUN apt-get update && \
|
||||
apt-get upgrade -y && \
|
||||
apt-get install --no-install-recommends -y \
|
||||
apt-transport-https \
|
||||
apt-utils \
|
||||
ca-certificates \
|
||||
curl \
|
||||
dumb-init \
|
||||
gpg \
|
||||
jq \
|
||||
locales \
|
||||
moreutils \
|
||||
python3 \
|
||||
&& \
|
||||
rm -rf /var/cache/apt /var/lib/apt/lists
|
||||
|
||||
RUN sed -i -e 's/# en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/' /etc/locale.gen && \
|
||||
sed -i -e 's/# de_DE.UTF-8 UTF-8/de_DE.UTF-8 UTF-8/' /etc/locale.gen && \
|
||||
dpkg-reconfigure --frontend=noninteractive locales && \
|
||||
update-locale LANG=en_US.UTF-8
|
||||
|
||||
ARG ADDITIONAL_KOPANO_PACKAGES=""
|
||||
ARG DOWNLOAD_COMMUNITY_PACKAGES=1
|
||||
ARG KOPANO_CORE_REPOSITORY_URL="file:/kopano/repo/core"
|
||||
ARG KOPANO_CORE_VERSION=newest
|
||||
ARG KOPANO_REPOSITORY_FLAGS="trusted=yes"
|
||||
ARG KOPANO_WEBAPP_REPOSITORY_URL="file:/kopano/repo/webapp"
|
||||
ARG KOPANO_WEBAPP_VERSION=newest
|
||||
ARG RELEASE_KEY_DOWNLOAD=0
|
||||
|
||||
# get common utilities
|
||||
COPY create-kopano-repo.sh /kopano/helper/
|
||||
RUN date +%s > /kopano/buildversion
|
||||
|
||||
SHELL [ "/bin/bash", "-c"]
|
||||
Executable
+49
@@ -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 ".."
|
||||
}
|
||||
Reference in New Issue
Block a user