summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorlouiz’ <louiz@louiz.org>2017-02-28 19:39:09 +0100
committerlouiz’ <louiz@louiz.org>2017-02-28 19:39:09 +0100
commit26eb28dc2368d14e171201a0c6b76b76b19e1ddc (patch)
treeafe81334ec7fdab43fabe18733e4c73bfedc6a3f
parentdcb48c5a20be1440ad87f1996b3373cb51f0fe07 (diff)
downloadbiboumi-26eb28dc2368d14e171201a0c6b76b76b19e1ddc.tar.gz
biboumi-26eb28dc2368d14e171201a0c6b76b76b19e1ddc.tar.bz2
biboumi-26eb28dc2368d14e171201a0c6b76b76b19e1ddc.tar.xz
biboumi-26eb28dc2368d14e171201a0c6b76b76b19e1ddc.zip
Split the biboumi dockerfile into two, to be able to disable the cache
-rw-r--r--.gitlab-ci.yml2
-rw-r--r--docker/biboumi/Dockerfile30
-rw-r--r--docker/biboumi/Dockerfile.base23
-rw-r--r--docker/biboumi/README.rst20
-rwxr-xr-xdocker/biboumi/build-docker.sh14
5 files changed, 63 insertions, 26 deletions
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index facda29..70c1fe8 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -190,5 +190,5 @@ packaging:docker:
before_script: []
script:
- docker login -p $DOCKER_PASSWORD -u louiz
- - docker build -t louiz/biboumi docker/biboumi
+ - ./docker/biboumi/build-docker.sh louiz/biboumi
- docker push louiz/biboumi
diff --git a/docker/biboumi/Dockerfile b/docker/biboumi/Dockerfile
index 721d106..7e73c9a 100644
--- a/docker/biboumi/Dockerfile
+++ b/docker/biboumi/Dockerfile
@@ -1,28 +1,8 @@
-# This Dockerfile creates a docker image running biboumi
-
-FROM docker.io/fedora:latest
-
-RUN dnf --refresh install -y\
- gcc-c++\
- cmake\
- make\
- udns-devel\
- sqlite-devel\
- libuuid-devel\
- expat-devel\
- libidn-devel\
- systemd-devel\
- git\
- python\
- && dnf clean all
-
-# Install botan
-RUN git clone https://github.com/randombit/botan.git && cd botan && ./configure.py --prefix=/usr && make -j8 && make install && ldconfig && rm -rf /botan
-
-# Install litesql
-RUN git clone git://git.louiz.org/litesql && mkdir /litesql/build && cd /litesql/build && cmake .. -DCMAKE_INSTALL_PREFIX=/usr && make -j8 && cd /litesql/build && make install && ldconfig && rm -rf /litesql
-
-# Install biboumi
+# This dockerfile uses the image built using Dockerfile.base, and installs
+# biboumi in it
+
+FROM biboumi-base
+
RUN git clone git://git.louiz.org/biboumi && mkdir ./biboumi/build && cd ./biboumi/build &&\
cmake .. -DCMAKE_INSTALL_PREFIX=/usr\
-DCMAKE_BUILD_TYPE=Release\
diff --git a/docker/biboumi/Dockerfile.base b/docker/biboumi/Dockerfile.base
new file mode 100644
index 0000000..bbc32c2
--- /dev/null
+++ b/docker/biboumi/Dockerfile.base
@@ -0,0 +1,23 @@
+# This dockerfile install all the dependencies needing to compile biboumi
+
+FROM docker.io/fedora:latest
+
+RUN dnf --refresh install -y\
+ gcc-c++\
+ cmake\
+ make\
+ udns-devel\
+ sqlite-devel\
+ libuuid-devel\
+ expat-devel\
+ libidn-devel\
+ systemd-devel\
+ git\
+ python\
+ && dnf clean all
+
+# Install botan
+RUN git clone https://github.com/randombit/botan.git && cd botan && ./configure.py --prefix=/usr && make -j8 && make install && ldconfig && rm -rf /botan
+
+# Install litesql
+RUN git clone git://git.louiz.org/litesql && mkdir /litesql/build && cd /litesql/build && cmake .. -DCMAKE_INSTALL_PREFIX=/usr && make -j8 && cd /litesql/build && make install && ldconfig && rm -rf /litesql
diff --git a/docker/biboumi/README.rst b/docker/biboumi/README.rst
index f6d529d..d2e2a7e 100644
--- a/docker/biboumi/README.rst
+++ b/docker/biboumi/README.rst
@@ -76,3 +76,23 @@ The database is stored in the /var/lib/biboumi/ directory. If you don’t bind
a local directory to it, the database will be lost when the container is
stopped. If you want to keep your database between each run, bind it with
the -v option, like this: **-v /srv/biboumi/:/var/lib/biboumi**.
+
+Building
+--------
+
+This image is built from 2 Dockerfiles:
+- Dockerfile.base: builds and installs all the dependencies needed to build and run biboumi
+- Dockerfile: builds and installs biboumi itself
+
+The goal is to be able to force the rebuild of biboumi itself (by using
+the --no-cache option) without having to rebuild and install all its
+dependencies.
+
+The build does not require any file in the build context, everything is
+fetched during the build using git or dnf.
+
+To build a biboumi image named “foo/biboumi”, you can run the script:
+
+```
+./build-docker.sh foo/biboumi
+```
diff --git a/docker/biboumi/build-docker.sh b/docker/biboumi/build-docker.sh
new file mode 100755
index 0000000..d206b89
--- /dev/null
+++ b/docker/biboumi/build-docker.sh
@@ -0,0 +1,14 @@
+#!/bin/sh
+
+if [[ -z "$1" ]]; then
+ echo "Usage: ./build-docker.sh <image_name>"
+ echo "Example: ./build-docker.sh docker.io/coucou/biboumi"
+ exit 1
+fi
+
+directory=$(dirname $0)
+image_name=$1
+
+echo $directory
+docker build -t biboumi-base $directory -f $directory/Dockerfile.base
+docker build -t $image_name $directory -f $directory/Dockerfile --no-cache