kallithea-docker questions/problems

Thomas De Schampheleire patrickdepinguin at gmail.com
Tue Jun 20 19:57:18 UTC 2017


Hi Dominik,

I took a look at your kallithea-docker repo because I would like to
start using Docker to launch my Kallithea instances.

I built an image based on your Dockerfile, but face a few problems
with the kallithea-entry-point.sh script. For example, the syntax to
create the config file now does not take the 'Kallithea' argument, so
one change is:

diff --git a/kallithea-entry-point.sh b/kallithea-entry-point.sh
--- a/kallithea-entry-point.sh
+++ b/kallithea-entry-point.sh
@@ -23,7 +23,7 @@ function create_db {

 if [ "$2" == "serve" ]; then
     if [ ! -s $KALLITHEA_PATH/conf/kallithea.ini ]; then
-        gearbox make-config Kallithea $KALLITHEA_PATH/conf/kallithea.ini
+        gearbox make-config $KALLITHEA_PATH/conf/kallithea.ini
         sed -i -e 's/host\s=\s127\.0\.0\.1/host = 0.0.0.0/g'
$KALLITHEA_PATH/conf/kallithea.ini
     fi

Now, I noticed other issues in this file, that I will try to fix, but
I wonder what is the most efficient way to work here. Right now, I am
making changes in kallithea-entry-point.sh, rebuild the image, create
container, check the logs to see if it's better, repeat. But I feel
there must be a better way. Do you have some suggestions (I'm
relatively new to Docker).


Related to the Dockerfile itself, I reordered some blocks to attempt
to improve layer cache usage when a new Kallithea version is desired.
For example, the apt-get updates and the installation of dockerize are
expected to be quite invariant, and could be added higher than the
cloning of Kallithea which may change more often. Below my current
diff, comments welcome.

diff --git a/Dockerfile b/Dockerfile
--- a/Dockerfile
+++ b/Dockerfile
@@ -2,38 +2,49 @@ FROM python:2.7

 MAINTAINER Dominik Ruf <dominikruf at gmail.com>

+ARG URL=https://kallithea-scm.org/repos/kallithea
+ARG REV=stable
+ARG http_proxy=
+ARG https_proxy=
+
 ENV DEBIAN_FRONTEND=noninteractive
 ENV KALLITHEA_PATH /var/kallithea
-ARG URL=https://kallithea-scm.org/repos/kallithea
-ARG REV=stable
+ENV http_proxy=$http_proxy
+ENV https_proxy=$https_proxy

 # add kallithea user
 RUN useradd -d $KALLITHEA_PATH -u 1000 -m -s /bin/bash kallithea

-# get kalilteha sources
+# install dockerize
+RUN cd $KALLITHEA_PATH && \
+    wget https://github.com/jwilder/dockerize/releases/download/v0.4.0/dockerize-linux-amd64-v0.4.0.tar.gz
&& \
+    tar -C /usr/local/bin -xzvf dockerize-linux-amd64-v0.4.0.tar.gz && \
+    rm dockerize-linux-amd64-v0.4.0.tar.gz
+
+# install dependencies
+RUN apt-get update && \
+    apt-get install -y --no-install-recommends \
+        python-dev \
+        python-ldap \
+        pwgen
+
+# get kallithea sources
 RUN mkdir -p $KALLITHEA_PATH/conf && \
     mkdir $KALLITHEA_PATH/repos && \
     hg clone $URL -r $REV $KALLITHEA_PATH/src && \
     rm -r $KALLITHEA_PATH/src/.hg && \
     chown -R kallithea $KALLITHEA_PATH

-# install dependencies
-RUN apt-get update && \
-    apt-get install -y --no-install-recommends \
-        python-dev \
-        python-ldap \
-        pwgen && \
-
-    cd $KALLITHEA_PATH/src && \
+RUN cd $KALLITHEA_PATH/src && \
     pip install --no-cache-dir --upgrade -e . && \
     pip install --no-cache-dir --upgrade \
         psycopg2 \
         mysql-python \
         hg-evolve && \
     python setup.py compile_catalog && \
-    chown -R kallithea $KALLITHEA_PATH && \
+    chown -R kallithea $KALLITHEA_PATH

-    apt-get purge --auto-remove -y python-dev && \
+RUN apt-get purge --auto-remove -y python-dev && \
     apt-get autoremove && \
     apt-get autoclean && \
     rm -rf /var/lib/apt/lists/*
@@ -57,12 +68,6 @@ RUN if [ -f $KALLITHEA_PATH/src/kallithe
         rm -rf /var/lib/apt/lists/*; \
     fi

-# install dockerize
-RUN cd $KALLITHEA_PATH && \
-    wget https://github.com/jwilder/dockerize/releases/download/v0.4.0/dockerize-linux-amd64-v0.4.0.tar.gz
&& \
-    tar -C /usr/local/bin -xzvf dockerize-linux-amd64-v0.4.0.tar.gz && \
-    rm dockerize-linux-amd64-v0.4.0.tar.gz
-
 VOLUME $KALLITHEA_PATH/repos
 VOLUME $KALLITHEA_PATH/conf


Thanks,
Thomas


More information about the kallithea-general mailing list