From 090304db01e2bfbb7ed07c87ec41307a96c3f66e Mon Sep 17 00:00:00 2001 From: tiennm99 Date: Sun, 5 Oct 2025 00:07:08 +0700 Subject: [PATCH] Refactor Couchbase 2.5 image and remove old couchbase directory Removed the legacy couchbase/ directory and its scripts, consolidating the Docker build to couchbase-2.5. Updated the Dockerfile to download dependencies and the Couchbase package directly, simplifying the build process. Updated the workflow to remove manual .deb downloads and changed the image tag to 'latest'. Updated README to reflect these changes and clarify credits. --- .github/workflows/publish-couchbase-2.5.yml | 14 +--- README.md | 5 +- couchbase-2.5/Dockerfile | 35 +++++----- couchbase/Dockerfile | 76 --------------------- couchbase/scripts/dummy.sh | 3 - couchbase/scripts/entrypoint.sh | 59 ---------------- couchbase/scripts/run | 19 ------ 7 files changed, 21 insertions(+), 190 deletions(-) delete mode 100644 couchbase/Dockerfile delete mode 100644 couchbase/scripts/dummy.sh delete mode 100644 couchbase/scripts/entrypoint.sh delete mode 100644 couchbase/scripts/run diff --git a/.github/workflows/publish-couchbase-2.5.yml b/.github/workflows/publish-couchbase-2.5.yml index 323f210..0494ff6 100644 --- a/.github/workflows/publish-couchbase-2.5.yml +++ b/.github/workflows/publish-couchbase-2.5.yml @@ -18,18 +18,6 @@ jobs: - name: Checkout uses: actions/checkout@v3 - - name: Download Couchbase 2.5.2 RPM - run: | - cd couchbase-2.5 - wget https://launchpadlibrarian.net/90920725/libgpg-error0_1.10-2ubuntu1_amd64.deb - wget https://launchpadlibrarian.net/462496703/libgcrypt11_1.5.0-3ubuntu0.9_amd64.deb - wget https://launchpadlibrarian.net/98077365/libp11-kit0_0.12-2ubuntu1_amd64.deb - wget https://launchpadlibrarian.net/329563761/libtasn1-3_2.10-1ubuntu1.6_amd64.deb - wget https://launchpadlibrarian.net/311120336/libgnutls26_2.12.14-5ubuntu3.14_amd64.deb - wget https://launchpadlibrarian.net/320724516/librtmp0_2.4~20110711.gitc28f1bab-1ubuntu0.1_amd64.deb - wget https://launchpadlibrarian.net/178402337/libssl0.9.8_0.9.8o-7ubuntu3.2_amd64.deb - wget https://packages.couchbase.com/releases/2.5.2/couchbase-server-enterprise_2.5.2_x86_64.deb - - name: Log in to GitHub Container Registry uses: docker/login-action@v2 with: @@ -43,7 +31,7 @@ jobs: with: images: ghcr.io/${{ github.repository }}/couchbase-2.5 tags: | - type=raw,value=2.5 + type=raw,value=latest - name: Build and push Docker image uses: docker/build-push-action@v4 diff --git a/README.md b/README.md index f18a3ef..e61dd88 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,9 @@ # Docker Images +My custom Docker images. Most of them are legacy packages that not be supported anymore, so don't have a official Docker image. + ## Credits: -### Couchbase +### Couchbase-2.5 +- https://docs.couchbase.com/couchbase-manual-2.5/cb-install/ - https://github.com/couchbase/docker/tree/couchbase-server-4.0.0-community diff --git a/couchbase-2.5/Dockerfile b/couchbase-2.5/Dockerfile index 05d4ce8..9added6 100644 --- a/couchbase-2.5/Dockerfile +++ b/couchbase-2.5/Dockerfile @@ -1,27 +1,24 @@ -# Docs: https://docs.couchbase.com/couchbase-manual-2.5/cb-install - FROM ubuntu:12.04 LABEL maintainer="Tien Nguyen Minh " -COPY *.deb /tmp/ +ARG CB_VERSION=2.5.2 +ARG CB_RELEASE_URL=https://packages.couchbase.com/releases +ARG CB_PACKAGE=couchbase-server-enterprise_2.5.2_x86_64.deb -RUN dpkg -i /tmp/libgpg-error0_*.deb && \ - dpkg -i /tmp/libgcrypt11_*.deb && \ - dpkg -i /tmp/libp11-kit0_*.deb && \ - dpkg -i /tmp/libtasn1-3_*.deb && \ - dpkg -i /tmp/libgnutls26_*.deb && \ - dpkg -i /tmp/librtmp0_*.deb && \ - dpkg -i /tmp/libssl0.9.8_*.deb && \ - export INSTALL_DONT_START_SERVER=1 && \ - dpkg -i /tmp/couchbase-server-enterprise_*.deb && \ - rm /tmp/*.deb +ENV DEBIAN_FRONTEND=noninteractive -# Expose ports -# 8091: Web Administration Port -# 8092: Couchbase API Port -# 11210: Internal/External Bucket Port -# 11211: Client interface (proxy) -EXPOSE 8091 8092 11210 11211 +RUN sed -i 's|http://archive.ubuntu.com/ubuntu/|http://old-releases.ubuntu.com/ubuntu/|g' /etc/apt/sources.list && \ + sed -i 's|http://security.ubuntu.com/ubuntu|http://old-releases.ubuntu.com/ubuntu|g' /etc/apt/sources.list && \ + apt-get update + +RUN apt-get install -y wget +RUN wget --no-check-certificate $CB_RELEASE_URL/$CB_VERSION/$CB_PACKAGE +RUN apt-get install -y libssl0.9.8 +RUN apt-get install -y librtmp0 +RUN export INSTALL_DONT_START_SERVER=1 && \ + dpkg -i ./$CB_PACKAGE && rm -f ./$CB_PACKAGE + +EXPOSE 8091, 8092, 11210, 11211 CMD ["/opt/couchbase/bin/couchbase-server", "--", "-noinput"] diff --git a/couchbase/Dockerfile b/couchbase/Dockerfile deleted file mode 100644 index 42a0982..0000000 --- a/couchbase/Dockerfile +++ /dev/null @@ -1,76 +0,0 @@ -FROM ubuntu:14.04 - -MAINTAINER Couchbase Docker Team - -# Install dependencies: -# runit: for container process management -# wget: for downloading .deb -# python-httplib2: used by CLI tools -# chrpath: for fixing curl, below -# tzdata: timezone info used by some N1QL functions -# Additional dependencies for system commands used by cbcollect_info: -# lsof: lsof -# lshw: lshw -# sysstat: iostat, sar, mpstat -# net-tools: ifconfig, arp, netstat -# numactl: numactl -RUN apt-get update && \ - apt-get install -yq runit wget python-httplib2 chrpath tzdata \ - lsof lshw sysstat net-tools numactl && \ - apt-get autoremove && apt-get clean && \ - rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* - -ARG CB_VERSION=2.5.2 -ARG CB_RELEASE_URL=https://packages.couchbase.com/releases -ARG CB_PACKAGE=couchbase-server-enterprise_2.5.2_x86_64.deb -# ARG CB_SHA256=e275717da0c22efb846b397a1ffeaf63a21ec91e4e481efe3b59de0a0d530982 - -ENV PATH=$PATH:/opt/couchbase/bin:/opt/couchbase/bin/tools:/opt/couchbase/bin/install - -# Create Couchbase user with UID 1000 (necessary to match default -# boot2docker UID) -RUN groupadd -g 1000 couchbase && useradd couchbase -u 1000 -g couchbase -M - -# Install couchbase -RUN export INSTALL_DONT_START_SERVER=1 && \ - wget -N $CB_RELEASE_URL/$CB_VERSION/$CB_PACKAGE && \ - # echo "$CB_SHA256 $CB_PACKAGE" | sha256sum -c - && \ - dpkg -i ./$CB_PACKAGE && rm -f ./$CB_PACKAGE - -# Add runit script for couchbase-server -COPY scripts/run /etc/service/couchbase-server/run -RUN chown -R couchbase:couchbase /etc/service - -# Add dummy script for commands invoked by cbcollect_info that -# make no sense in a Docker container -COPY scripts/dummy.sh /usr/local/bin/ -RUN ln -s dummy.sh /usr/local/bin/iptables-save && \ - ln -s dummy.sh /usr/local/bin/lvdisplay && \ - ln -s dummy.sh /usr/local/bin/vgdisplay && \ - ln -s dummy.sh /usr/local/bin/pvdisplay - -# Fix curl RPATH -RUN chrpath -r '$ORIGIN/../lib' /opt/couchbase/bin/curl - -# Add bootstrap script -COPY scripts/entrypoint.sh / -ENTRYPOINT ["/entrypoint.sh"] -CMD ["couchbase-server"] - -# 8091: Couchbase Web console, REST/HTTP interface -# 8092: Views, queries, XDCR -# 8093: Query services (4.0+) -# 8094: Full-text Search (4.5+) -# 8095: Analytics (5.5+) -# 8096: Eventing (5.5+) -# 11207: Smart client library data node access (SSL) -# 11210: Smart client library/moxi data node access -# 11211: Legacy non-smart client library data node access -# 18091: Couchbase Web console, REST/HTTP interface (SSL) -# 18092: Views, query, XDCR (SSL) -# 18093: Query services (SSL) (4.0+) -# 18094: Full-text Search (SSL) (4.5+) -# 18095: Analytics (SSL) (5.5+) -# 18096: Eventing (SSL) (5.5+) -EXPOSE 8091 8092 8093 8094 8095 8096 11207 11210 11211 18091 18092 18093 18094 18095 18096 -VOLUME /opt/couchbase/var diff --git a/couchbase/scripts/dummy.sh b/couchbase/scripts/dummy.sh deleted file mode 100644 index 1c0c100..0000000 --- a/couchbase/scripts/dummy.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh - -echo "Running in Docker container - $0 not available" diff --git a/couchbase/scripts/entrypoint.sh b/couchbase/scripts/entrypoint.sh deleted file mode 100644 index 25dea8d..0000000 --- a/couchbase/scripts/entrypoint.sh +++ /dev/null @@ -1,59 +0,0 @@ -#!/bin/bash -set -e - -staticConfigFile=/opt/couchbase/etc/couchbase/static_config -restPortValue=8091 - -# see https://developer.couchbase.com/documentation/server/current/install/install-ports.html -function overridePort() { - portName=$1 - portNameUpper=$(echo $portName | awk '{print toupper($0)}') - portValue=${!portNameUpper} - - # only override port if value available AND not already contained in static_config - if [ "$portValue" != "" ]; then - if grep -Fq "{${portName}," ${staticConfigFile} - then - echo "Don't override port ${portName} because already available in $staticConfigFile" - else - echo "Override port '$portName' with value '$portValue'" - echo "{$portName, $portValue}." >> ${staticConfigFile} - - if [ ${portName} == "rest_port" ]; then - restPortValue=${portValue} - fi - fi - fi -} - -overridePort "rest_port" -overridePort "mccouch_port" -overridePort "memcached_port" -overridePort "query_port" -overridePort "ssl_query_port" -overridePort "fts_http_port" -overridePort "moxi_port" -overridePort "ssl_rest_port" -overridePort "ssl_capi_port" -overridePort "ssl_proxy_downstream_port" -overridePort "ssl_proxy_upstream_port" - - -[[ "$1" == "couchbase-server" ]] && { - - if [ "$(whoami)" = "couchbase" ]; then - # Ensure that /opt/couchbase/var is owned by user 'couchbase' and - # is writable - if [ ! -w /opt/couchbase/var -o \ - $(find /opt/couchbase/var -maxdepth 0 -printf '%u') != "couchbase" ]; then - echo "/opt/couchbase/var is not owned and writable by UID 1000" - echo "Aborting as Couchbase Server will likely not run" - exit 1 - fi - fi - echo "Starting Couchbase Server -- Web UI available at http://:$restPortValue" - echo "and logs available in /opt/couchbase/var/lib/couchbase/logs" - exec /usr/sbin/runsvdir-start -} - -exec "$@" diff --git a/couchbase/scripts/run b/couchbase/scripts/run deleted file mode 100644 index be2e6fe..0000000 --- a/couchbase/scripts/run +++ /dev/null @@ -1,19 +0,0 @@ -#!/bin/sh - -exec 2>&1 - -# Create directories where couchbase stores its data -cd /opt/couchbase -mkdir -p var/lib/couchbase \ - var/lib/couchbase/config \ - var/lib/couchbase/data \ - var/lib/couchbase/stats \ - var/lib/couchbase/logs \ - var/lib/moxi - -chown -R couchbase:couchbase var -if [ $(whoami) = "couchbase" ]; then - exec /opt/couchbase/bin/couchbase-server -- -kernel global_enable_tracing false -noinput -else - exec chpst -ucouchbase /opt/couchbase/bin/couchbase-server -- -kernel global_enable_tracing false -noinput -fi