From b57f599102645a5f0e4b0d314c37f4582a6e4219 Mon Sep 17 00:00:00 2001 From: ober Date: Thu, 12 Oct 2023 01:23:49 -0600 Subject: [PATCH 01/10] add values required to build --- docker/Makefile | 55 ++++++++++++++++++++++++++++++++++++------------- 1 file changed, 41 insertions(+), 14 deletions(-) diff --git a/docker/Makefile b/docker/Makefile index a5284f7d8..1e04f9919 100755 --- a/docker/Makefile +++ b/docker/Makefile @@ -96,58 +96,85 @@ gerbilxx: --build-arg configure_args="--enable-c++ --enable-march=" \ --build-arg cores=$(cores) \ --build-arg with_db="YES" \ - --build-arg distro="alpine" -t final $(ROOT_DIR) \ + --build-arg distro="alpine" + --build-arg shared="no" \ + -t final $(ROOT_DIR) \ --progress=plain docker tag final gerbil/gerbilxx:$(arch) gerbil: docker build --target final \ --rm=true --no-cache \ - --build-arg repo="$(REPO)" \ --build-arg branch="$(BRANCH)" \ - --build-arg packages="$(alpine_packages)" \ --build-arg configure_args="--enable-march=" \ --build-arg cores=$(cores) \ - --build-arg distro="alpine" -t final $(ROOT_DIR) \ + --build-arg distro="alpine" + --build-arg packages="$(alpine_packages)" \ + --build-arg repo="$(REPO)" \ + --build-arg shared="no" \ + -t final $(ROOT_DIR) \ --progress=plain docker tag final gerbil/gerbil:$(arch) amazonlinux: docker build --target final \ + --rm=true --no-cache \ + --build-arg branch="$(BRANCH)" \ + --build-arg configure_args="--enable-c++ --enable-march=" \ + --build-arg cores=$(cores) \ + --build-arg distro="amazonlinux" \ --build-arg gerbil_version=$(GERBIL_VERSION) \ --build-arg packages="$(amazon_packages)" \ - --build-arg cores=$(cores) \ - --build-arg distro="amazonlinux" \ + --build-arg repo="$(REPO)" \ + --build-arg shared="yes" \ + --build-arg with_db="YES" \ -t final $(ROOT_DIR) docker tag final gerbil/amazonlinux:$(arch) centos: docker build --target final \ --rm=true --no-cache \ - --build-arg gerbil_version=$(GERBIL_VERSION) \ - --build-arg packages="$(centos_packages)" \ + --build-arg branch="$(BRANCH)" \ + --build-arg configure_args="--enable-c++ --enable-march=" \ --build-arg cores=$(cores) \ --build-arg distro="centos" \ + --build-arg gerbil_version=$(GERBIL_VERSION) \ + --build-arg packages="$(centos_packages)" \ + --build-arg repo="$(REPO)" \ + --build-arg shared="yes" \ + --build-arg with_db="YES" \ -t final $(ROOT_DIR) docker tag final gerbil/centos:$(arch) fedora: docker build --target final \ - --build-arg gerbil_version=$(GERBIL_VERSION) \ - --build-arg packages="$(fedora_packages)" \ + --build-arg branch="$(BRANCH)" \ + --build-arg configure_args="--enable-c++ --enable-march=" \ --build-arg cores=$(cores) \ --build-arg distro="fedora" \ - -t final $(ROOT_DIR) + --build-arg gerbil_version=$(GERBIL_VERSION) \ + --build-arg packages="$(fedora_packages)" \ + --build-arg repo="$(REPO)" \ + --build-arg shared="yes" \ + --build-arg with_db="YES" \ + -t final $(ROOT_DIR) \ + --progress=plain docker tag final gerbil/fedora:$(arch) ubuntu: docker build --target final \ --rm=true --no-cache \ - --build-arg gerbil_version=$(GERBIL_VERSION) \ - --build-arg packages="$(ubuntu_packages)" \ + --build-arg branch="$(BRANCH)" \ + --build-arg configure_args="--enable-c++ --enable-march=" \ --build-arg cores=$(cores) \ --build-arg distro="ubuntu" \ - -t final $(ROOT_DIR) + --build-arg gerbil_version=$(GERBIL_VERSION) \ + --build-arg packages="$(ubuntu_packages)" \ + --build-arg repo="$(REPO)" \ + --build-arg shared="yes" \ + --build-arg with_db="YES" \ + -t final $(ROOT_DIR) \ + --progress=plain docker tag final gerbil/ubuntu:$(arch) ubuntu-current-jedi: From 5fcf3f4416d36a8aad7f986295dce3e6d8eafd1b Mon Sep 17 00:00:00 2001 From: ober Date: Thu, 12 Oct 2023 01:23:57 -0600 Subject: [PATCH 02/10] Update dockerfile as well --- docker/Dockerfile | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/docker/Dockerfile b/docker/Dockerfile index 374adae2a..107af32d9 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -5,6 +5,7 @@ ARG branch ARG cores ARG configure_args ARG packages +ARG shared FROM ${distro}:latest as base ARG cores @@ -43,13 +44,14 @@ RUN case ${distro} in \ esac FROM base as gerbil -ARG cores -ARG repo ARG branch ARG configure_args +ARG cores +ARG repo +ARG shared ENV GERBIL_GCC=g++ -RUN cd /opt && eval git clone -b "${branch}" "https://github.com/${repo}" gerbil-src \ - && cd /opt/gerbil-src && eval ./configure --prefix=/opt/gerbil --enable-shared=no ${configure_args} +RUN cd /opt && eval git clone -b "${branch}" "https://github.com/${repo}" gerbil-src \ + && cd /opt/gerbil-src && eval ./configure --prefix=/opt/gerbil --enable-shared=${shared} ${configure_args} RUN cd /opt/gerbil-src && make && make install From e886c3fb4fa80d43b989c2a388f5932ef7ab1bec Mon Sep 17 00:00:00 2001 From: ober Date: Thu, 12 Oct 2023 02:21:06 -0600 Subject: [PATCH 03/10] remove g++ --- docker/Dockerfile | 1 - 1 file changed, 1 deletion(-) diff --git a/docker/Dockerfile b/docker/Dockerfile index 107af32d9..7c746230f 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -49,7 +49,6 @@ ARG configure_args ARG cores ARG repo ARG shared -ENV GERBIL_GCC=g++ RUN cd /opt && eval git clone -b "${branch}" "https://github.com/${repo}" gerbil-src \ && cd /opt/gerbil-src && eval ./configure --prefix=/opt/gerbil --enable-shared=${shared} ${configure_args} From fdb6073fdc68abc20369be2c44cf41d978ba4f7a Mon Sep 17 00:00:00 2001 From: ober Date: Thu, 12 Oct 2023 02:28:58 -0600 Subject: [PATCH 04/10] clean up fedora --- docker/Makefile | 1 + 1 file changed, 1 insertion(+) diff --git a/docker/Makefile b/docker/Makefile index 1e04f9919..70cb44149 100755 --- a/docker/Makefile +++ b/docker/Makefile @@ -148,6 +148,7 @@ centos: fedora: docker build --target final \ + --rm=true --no-cache \ --build-arg branch="$(BRANCH)" \ --build-arg configure_args="--enable-c++ --enable-march=" \ --build-arg cores=$(cores) \ From 964d33b9d03233649faff8ab0ec475cf71c2e42a Mon Sep 17 00:00:00 2001 From: ober Date: Thu, 12 Oct 2023 02:52:01 -0600 Subject: [PATCH 05/10] add centos_packages --- docker/Makefile | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/docker/Makefile b/docker/Makefile index 70cb44149..39d3c85ba 100755 --- a/docker/Makefile +++ b/docker/Makefile @@ -55,6 +55,15 @@ amazon_packages := cmake \ openssl-devel \ sqlite-devel +centos_packages := cmake \ + leveldb-devel \ + libsqlite3x-devel \ + libxml2-devel \ + libyaml-devel \ + lmdb-devel \ + openssl-devel \ + sqlite-devel + fedora_packages := cmake \ leveldb-devel \ libsqlite3x-devel \ From 65bb41c6c34f2c7a1386585f949003dbc5c50dae Mon Sep 17 00:00:00 2001 From: ober Date: Thu, 12 Oct 2023 02:52:54 -0600 Subject: [PATCH 06/10] add git --- docker/Makefile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/docker/Makefile b/docker/Makefile index 39d3c85ba..b13b4f02e 100755 --- a/docker/Makefile +++ b/docker/Makefile @@ -56,7 +56,8 @@ amazon_packages := cmake \ sqlite-devel centos_packages := cmake \ - leveldb-devel \ + git \ + leveldb-devel \ libsqlite3x-devel \ libxml2-devel \ libyaml-devel \ From 74ec9baac1988fcd08036cb2e6d1a24741a4fa89 Mon Sep 17 00:00:00 2001 From: ober Date: Thu, 12 Oct 2023 02:53:51 -0600 Subject: [PATCH 07/10] remove left over g++ --- docker/Dockerfile | 1 - 1 file changed, 1 deletion(-) diff --git a/docker/Dockerfile b/docker/Dockerfile index 7c746230f..93e41211d 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -15,7 +15,6 @@ ARG packages ENV PATH=/opt/gerbil/bin:/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin ENV GERBIL_BUILD_CORES=$cores ENV DEBIAN_FRONTEND=noninteractive -ENV GERBIL_GCC=g++ RUN mkdir -p /src /opt RUN case ${distro} in \ alpine) \ From 3e0b20665b890ebfb0aec933a6eb558849f198e6 Mon Sep 17 00:00:00 2001 From: ober Date: Tue, 17 Oct 2023 18:35:13 -0600 Subject: [PATCH 08/10] Add branch suffix. --- .github/workflows/docker-image.yml | 4 ++- doc/guide/docker.md | 3 ++ docker/Dockerfile | 5 +-- docker/Makefile | 53 +++++++++++++++++++++++++----- 4 files changed, 54 insertions(+), 11 deletions(-) diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml index 47ace5814..167e70f07 100644 --- a/.github/workflows/docker-image.yml +++ b/.github/workflows/docker-image.yml @@ -25,5 +25,7 @@ jobs: - name: Push to Docker Hub on Pushes to master run: | docker login -u gerbil -p ${{ secrets.DOCKER_TOKEN }} - docker push gerbil/${{ matrix.docker-image }}:$(uname -m) + docker push gerbil/${{ matrix.docker-image }}:$(uname -m)-master + docker manifest create gerbil/${{ matrix.docker-image }}:master --amend gerbil/gerbil:aarch64-master --amend gerbil/gerbil:x86_64-master + docker manifest push gerbil/${{ matrix.docker-image }}:master if: github.event_name == 'push' diff --git a/doc/guide/docker.md b/doc/guide/docker.md index 97a8a31ea..c5d788ffe 100644 --- a/doc/guide/docker.md +++ b/doc/guide/docker.md @@ -7,6 +7,9 @@ We offer two official docker images based on Alpine Linux: - `gerbilxx` is the full image, configured without shared libraries and with C++ enabled. It also includes all the foreign dependencies required by the officially supported external packages. +- Supported architectures are `aarch64` and `x86_64`. +- `:latest` always points at the last release, e.g. `v0.18` +- `:master` points to the latest merge into the `master` branch. Alpine was chosen due to the static compilation environment and capabilities it provides. diff --git a/docker/Dockerfile b/docker/Dockerfile index 93e41211d..264367765 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -32,7 +32,7 @@ RUN case ${distro} in \ yum update -y && yum groupinstall -y 'Development Tools' && \ eval yum install -y ${packages} \ ;; \ - ubuntu) \ + debian|ubuntu) \ apt update -y && \ eval apt install -y ${packages} \ ;; \ @@ -51,7 +51,8 @@ ARG shared RUN cd /opt && eval git clone -b "${branch}" "https://github.com/${repo}" gerbil-src \ && cd /opt/gerbil-src && eval ./configure --prefix=/opt/gerbil --enable-shared=${shared} ${configure_args} -RUN cd /opt/gerbil-src && make && make install +RUN cd /opt/gerbil-src && make +RUN cd /opt/gerbil-src && make install FROM gerbil as final RUN rm -rf /opt/gerbil-src /src/leveldb /src/lmdb diff --git a/docker/Makefile b/docker/Makefile index b13b4f02e..5aaa2bdce 100755 --- a/docker/Makefile +++ b/docker/Makefile @@ -1,4 +1,4 @@ -.PHONY: alpine amazonlinux ubuntu fedora ubuntu-current-jedi final +.PHONY: alpine amazonlinux debian ubuntu fedora ubuntu-current-jedi final ROOT_DIR := $(shell dirname $(realpath $(firstword $(MAKEFILE_LIST)))) cores := $(shell nproc) @@ -96,6 +96,28 @@ ubuntu_packages := autoconf \ texinfo \ zlib1g-dev +debian_packages := autoconf \ + bison \ + build-essential \ + curl \ + gawk \ + git \ + libleveldb-dev \ + libleveldb1d \ + liblmdb-dev \ + libnss3-dev \ + libsnappy1v5 \ + libsqlite3-dev \ + libssl-dev \ + libxml2-dev \ + libyaml-dev \ + pkg-config \ + python3 \ + rsync \ + rubygems \ + texinfo \ + zlib1g-dev + gerbilxx: docker build --target final \ --rm=true --no-cache \ @@ -110,7 +132,7 @@ gerbilxx: --build-arg shared="no" \ -t final $(ROOT_DIR) \ --progress=plain - docker tag final gerbil/gerbilxx:$(arch) + docker tag final gerbil/gerbilxx:$(arch)-$(BRANCH) gerbil: docker build --target final \ @@ -124,7 +146,7 @@ gerbil: --build-arg shared="no" \ -t final $(ROOT_DIR) \ --progress=plain - docker tag final gerbil/gerbil:$(arch) + docker tag final gerbil/gerbil:$(arch)-$(BRANCH) amazonlinux: docker build --target final \ @@ -139,7 +161,7 @@ amazonlinux: --build-arg shared="yes" \ --build-arg with_db="YES" \ -t final $(ROOT_DIR) - docker tag final gerbil/amazonlinux:$(arch) + docker tag final gerbil/amazonlinux:$(arch)-$(BRANCH) centos: docker build --target final \ @@ -154,11 +176,10 @@ centos: --build-arg shared="yes" \ --build-arg with_db="YES" \ -t final $(ROOT_DIR) - docker tag final gerbil/centos:$(arch) + docker tag final gerbil/centos:$(arch)-$(BRANCH) fedora: docker build --target final \ - --rm=true --no-cache \ --build-arg branch="$(BRANCH)" \ --build-arg configure_args="--enable-c++ --enable-march=" \ --build-arg cores=$(cores) \ @@ -170,7 +191,7 @@ fedora: --build-arg with_db="YES" \ -t final $(ROOT_DIR) \ --progress=plain - docker tag final gerbil/fedora:$(arch) + docker tag final gerbil/fedora:$(arch)-$(BRANCH) ubuntu: docker build --target final \ @@ -186,7 +207,23 @@ ubuntu: --build-arg with_db="YES" \ -t final $(ROOT_DIR) \ --progress=plain - docker tag final gerbil/ubuntu:$(arch) + docker tag final gerbil/ubuntu:$(arch)-$(BRANCH) + +debian: + docker build --target final \ + --rm=true --no-cache \ + --build-arg branch="$(BRANCH)" \ + --build-arg configure_args="--enable-c++ --enable-march=" \ + --build-arg cores=$(cores) \ + --build-arg distro="debian" \ + --build-arg gerbil_version=$(GERBIL_VERSION) \ + --build-arg packages="$(debian_packages)" \ + --build-arg repo="$(REPO)" \ + --build-arg shared="yes" \ + --build-arg with_db="YES" \ + -t final $(ROOT_DIR) \ + --progress=plain + docker tag final gerbil/ubuntu:$(arch)-$(BRANCH) ubuntu-current-jedi: docker build --rm=true --no-cache -t ubuntu-current-jedi $(ROOT_DIR)/ubuntu-current-jedi From 5577e8ac3753a58a61b6a60c66bbb68935d944e1 Mon Sep 17 00:00:00 2001 From: ober Date: Tue, 17 Oct 2023 18:43:17 -0600 Subject: [PATCH 09/10] Add examples for docker --- doc/guide/docker.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/doc/guide/docker.md b/doc/guide/docker.md index c5d788ffe..9b87ea78b 100644 --- a/doc/guide/docker.md +++ b/doc/guide/docker.md @@ -63,3 +63,15 @@ clean: install: mv .gerbil/bin/$(PROJECT) /usr/local/bin/$(PROJECT) ``` + +## Building docker images + +There are several variations you can build out on docker. + +### Build using custom branch + +`cd gerbil/docker && make gerbil BRANCH=my-fixup-branch` + +### Building from your own repository + +`cd gerbil/docker && make gerbil REPO=my-github-user/gerbil` From a1f5484da0e0cac7d124895bddd6f0c134b541b5 Mon Sep 17 00:00:00 2001 From: ober Date: Tue, 17 Oct 2023 19:04:52 -0600 Subject: [PATCH 10/10] missing backslack --- docker/Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docker/Makefile b/docker/Makefile index 5aaa2bdce..b510e73aa 100755 --- a/docker/Makefile +++ b/docker/Makefile @@ -128,7 +128,7 @@ gerbilxx: --build-arg configure_args="--enable-c++ --enable-march=" \ --build-arg cores=$(cores) \ --build-arg with_db="YES" \ - --build-arg distro="alpine" + --build-arg distro="alpine" \ --build-arg shared="no" \ -t final $(ROOT_DIR) \ --progress=plain @@ -140,7 +140,7 @@ gerbil: --build-arg branch="$(BRANCH)" \ --build-arg configure_args="--enable-march=" \ --build-arg cores=$(cores) \ - --build-arg distro="alpine" + --build-arg distro="alpine" \ --build-arg packages="$(alpine_packages)" \ --build-arg repo="$(REPO)" \ --build-arg shared="no" \