From 280bf377cb6ee2db27a849539dcb2b7e532970e5 Mon Sep 17 00:00:00 2001 From: gruve-p Date: Tue, 23 Apr 2024 15:15:58 +0200 Subject: [PATCH] Bump to 27.0 --- .github/workflows/build.yaml | 2 + 27/Dockerfile | 53 ++++++++++++++ 27/alpine/Dockerfile | 124 +++++++++++++++++++++++++++++++++ 27/alpine/docker-entrypoint.sh | 39 +++++++++++ 27/docker-entrypoint.sh | 39 +++++++++++ README.md | 5 +- 6 files changed, 261 insertions(+), 1 deletion(-) create mode 100644 27/Dockerfile create mode 100644 27/alpine/Dockerfile create mode 100644 27/alpine/docker-entrypoint.sh create mode 100644 27/docker-entrypoint.sh diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 6dca5d8..39ac18f 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -8,6 +8,8 @@ jobs: strategy: matrix: version: + - '27' + - '27/alpine' - '26' - '26/alpine' - '25' diff --git a/27/Dockerfile b/27/Dockerfile new file mode 100644 index 0000000..468d7a0 --- /dev/null +++ b/27/Dockerfile @@ -0,0 +1,53 @@ +FROM debian:bullseye-slim + +ARG UID=101 +ARG GID=101 + +LABEL maintainer="Groestlcoin developers " + +RUN groupadd --gid ${GID} groestlcoin \ + && useradd --create-home --no-log-init -u ${UID} -g ${GID} groestlcoin \ + && apt-get update -y \ + && apt-get install -y curl gnupg gosu \ + && apt-get clean \ + && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* + +ARG TARGETPLATFORM +ENV GROESTLCOIN_VERSION=27.0 +ENV GROESTLCOIN_DATA=/home/groestlcoin/.groestlcoin +ENV PATH=/opt/groestlcoin-${GROESTLCOIN_VERSION}/bin:$PATH + +RUN set -ex \ + && if [ "${TARGETPLATFORM}" = "linux/amd64" ]; then export TARGETPLATFORM=x86_64-linux-gnu; fi \ + && if [ "${TARGETPLATFORM}" = "linux/arm64" ]; then export TARGETPLATFORM=aarch64-linux-gnu; fi \ + && if [ "${TARGETPLATFORM}" = "linux/arm/v7" ]; then export TARGETPLATFORM=arm-linux-gnueabihf; fi \ + && for key in \ + 287AE4CA1187C68C08B49CB2D11BD4F33F1DB499 \ + ; do \ + gpg --batch --keyserver keyserver.ubuntu.com --recv-keys "$key" || \ + gpg --batch --keyserver keys.openpgp.org --recv-keys "$key" || \ + gpg --batch --keyserver pgp.mit.edu --recv-keys "$key" || \ + gpg --batch --keyserver keyserver.pgp.com --recv-keys "$key" || \ + gpg --batch --keyserver ha.pool.sks-keyservers.net --recv-keys "$key" || \ + gpg --batch --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys "$key" ; \ + done \ + && curl -SLO https://github.com/Groestlcoin/groestlcoin/releases/download/v${GROESTLCOIN_VERSION}/groestlcoin-${GROESTLCOIN_VERSION}-${TARGETPLATFORM}.tar.gz \ + && curl -SLO https://github.com/Groestlcoin/groestlcoin/releases/download/v${GROESTLCOIN_VERSION}/SHA256SUMS \ + && curl -SLO https://github.com/Groestlcoin/groestlcoin/releases/download/v${GROESTLCOIN_VERSION}/SHA256SUMS.asc \ + && gpg --verify SHA256SUMS.asc SHA256SUMS \ + && grep " groestlcoin-${GROESTLCOIN_VERSION}-${TARGETPLATFORM}.tar.gz" SHA256SUMS | sha256sum -c - \ + && tar -xzf *.tar.gz -C /opt \ + && rm *.tar.gz *.asc \ + && rm -rf /opt/groestlcoin-${GROESTLCOIN_VERSION}/bin/groestlcoin-qt + +COPY docker-entrypoint.sh /entrypoint.sh + +VOLUME ["/home/groestlcoin/.groestlcoin"] + +EXPOSE 1441 1331 17766 17777 18443 18888 31331 31441 + +ENTRYPOINT ["/entrypoint.sh"] + +RUN groestlcoind -version | grep "Groestlcoin Core version v${GROESTLCOIN_VERSION}" + +CMD ["groestlcoind"] diff --git a/27/alpine/Dockerfile b/27/alpine/Dockerfile new file mode 100644 index 0000000..2eaa976 --- /dev/null +++ b/27/alpine/Dockerfile @@ -0,0 +1,124 @@ +# Build stage for BerkeleyDB +FROM alpine as berkeleydb + +RUN sed -i 's/http\:\/\/dl-cdn.alpinelinux.org/https\:\/\/alpine.global.ssl.fastly.net/g' /etc/apk/repositories +RUN apk --no-cache add autoconf +RUN apk --no-cache add automake +RUN apk --no-cache add build-base +RUN apk --no-cache add libressl + +ENV BERKELEYDB_VERSION=db-5.3.28.NC +ENV BERKELEYDB_PREFIX=/opt/${BERKELEYDB_VERSION} + +RUN wget https://download.oracle.com/berkeley-db/${BERKELEYDB_VERSION}.tar.gz +RUN tar -xzf *.tar.gz +RUN sed s/__atomic_compare_exchange/__atomic_compare_exchange_db/g -i ${BERKELEYDB_VERSION}/src/dbinc/atomic.h +RUN sed s/atomic_init/atomic_init_db/g -i ${BERKELEYDB_VERSION}/src/dbinc/atomic.h ${BERKELEYDB_VERSION}/src/mp/mp_region.c ${BERKELEYDB_VERSION}/src/mp/mp_mvcc.c ${BERKELEYDB_VERSION}/src/mp/mp_fget.c ${BERKELEYDB_VERSION}/src/mutex/mut_method.c ${BERKELEYDB_VERSION}/src/mutex/mut_tas.c +RUN sed s/WinIoCtl.h/winioctl.h/g -i ${BERKELEYDB_VERSION}/src/dbinc/win_db.h +RUN mkdir -p ${BERKELEYDB_PREFIX} + +WORKDIR /${BERKELEYDB_VERSION}/build_unix + +RUN ../dist/configure --enable-cxx --disable-shared --with-pic --prefix=${BERKELEYDB_PREFIX} --build=aarch64-unknown-linux-gnu +RUN make -j4 +RUN make install +RUN rm -rf ${BERKELEYDB_PREFIX}/docs + +# Build stage for Groestlcoin Core +FROM alpine as groestlcoin-core + +COPY --from=berkeleydb /opt /opt + +RUN sed -i 's/http\:\/\/dl-cdn.alpinelinux.org/https\:\/\/alpine.global.ssl.fastly.net/g' /etc/apk/repositories +RUN apk --no-cache add autoconf +RUN apk --no-cache add automake +RUN apk --no-cache add boost-dev +RUN apk --no-cache add build-base +RUN apk --no-cache add chrpath +RUN apk --no-cache add file +RUN apk --no-cache add gnupg +RUN apk --no-cache add libevent-dev +RUN apk --no-cache add libressl +RUN apk --no-cache add libtool +RUN apk --no-cache add linux-headers +RUN apk --no-cache add sqlite-dev +RUN apk --no-cache add zeromq-dev +RUN set -ex \ + && for key in \ + 287AE4CA1187C68C08B49CB2D11BD4F33F1DB499 \ + ; do \ + gpg --batch --keyserver keyserver.ubuntu.com --recv-keys "$key" || \ + gpg --batch --keyserver keys.openpgp.org --recv-keys "$key" || \ + gpg --batch --keyserver keyserver.pgp.com --recv-keys "$key" || \ + gpg --batch --keyserver ha.pool.sks-keyservers.net --recv-keys "$key" || \ + gpg --batch --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys "$key" ; \ + done + +ENV GROESTLCOIN_VERSION=27.0 +ENV GROESTLCOIN_PREFIX=/opt/groestlcoin-${GROESTLCOIN_VERSION} + +RUN wget https://github.com/Groestlcoin/groestlcoin/releases/download/v${GROESTLCOIN_VERSION}/SHA256SUMS +RUN wget https://github.com/Groestlcoin/groestlcoin/releases/download/v${GROESTLCOIN_VERSION}/SHA256SUMS.asc +RUN wget https://github.com/Groestlcoin/groestlcoin/releases/download/v${GROESTLCOIN_VERSION}/groestlcoin-${GROESTLCOIN_VERSION}.tar.gz +RUN gpg --verify SHA256SUMS.asc SHA256SUMS +RUN grep " groestlcoin-${GROESTLCOIN_VERSION}.tar.gz\$" SHA256SUMS | sha256sum -c - +RUN tar -xzf *.tar.gz + +WORKDIR /groestlcoin-${GROESTLCOIN_VERSION} + +RUN sed -i s:sys/fcntl.h:fcntl.h: src/compat/compat.h +RUN ./autogen.sh +RUN ./configure LDFLAGS=-L`ls -d /opt/db*`/lib/ CPPFLAGS=-I`ls -d /opt/db*`/include/ \ + --prefix=${GROESTLCOIN_PREFIX} \ + --mandir=/usr/share/man \ + --disable-tests \ + --disable-bench \ + --disable-ccache \ + --with-gui=no \ + --with-utils \ + --with-libs \ + --with-sqlite=yes \ + --with-daemon +RUN make -j4 +RUN make install +RUN strip ${GROESTLCOIN_PREFIX}/bin/groestlcoin-cli +RUN strip ${GROESTLCOIN_PREFIX}/bin/groestlcoin-tx +RUN strip ${GROESTLCOIN_PREFIX}/bin/groestlcoind +RUN strip ${GROESTLCOIN_PREFIX}/lib/libgroestlcoinconsensus.a +RUN strip ${GROESTLCOIN_PREFIX}/lib/libgroestlcoinconsensus.so.0.0.0 + +# Build stage for compiled artifacts +FROM alpine + +ARG UID=100 +ARG GID=101 + +LABEL maintainer="Groestlcoin developers " + +RUN addgroup groestlcoin --gid ${GID} --system +RUN adduser --uid ${UID} --system groestlcoin --ingroup groestlcoin +RUN sed -i 's/http\:\/\/dl-cdn.alpinelinux.org/https\:\/\/alpine.global.ssl.fastly.net/g' /etc/apk/repositories +RUN apk --no-cache add \ + libevent \ + libzmq \ + shadow \ + sqlite-dev \ + su-exec + +ENV GROESTLCOIN_DATA=/home/groestlcoin/.groestlcoin +ENV GROESTLCOIN_VERSION=27.0 +ENV GROESTLCOIN_PREFIX=/opt/groestlcoin-${GROESTLCOIN_VERSION} +ENV PATH=${GROESTLCOIN_PREFIX}/bin:$PATH + +COPY --from=groestlcoin-core /opt /opt +COPY docker-entrypoint.sh /entrypoint.sh + +VOLUME ["/home/groestlcoin/.groestlcoin"] + +EXPOSE 1441 1331 17766 17777 18443 18888 31331 31441 + +ENTRYPOINT ["/entrypoint.sh"] + +RUN groestlcoind -version | grep "Groestlcoin Core version v${GROESTLCOIN_VERSION}" + +CMD ["groestlcoind"] diff --git a/27/alpine/docker-entrypoint.sh b/27/alpine/docker-entrypoint.sh new file mode 100644 index 0000000..f2dff4e --- /dev/null +++ b/27/alpine/docker-entrypoint.sh @@ -0,0 +1,39 @@ +#!/bin/sh +set -e + +if [ -n "${UID+x}" ] && [ "${UID}" != "0" ]; then + usermod -u "$UID" groestlcoin +fi + +if [ -n "${GID+x}" ] && [ "${GID}" != "0" ]; then + groupmod -g "$GID" groestlcoin +fi + +echo "$0: assuming uid:gid for groestlcoin:groestlcoin of $(id -u groestlcoin):$(id -g groestlcoin)" + +if [ $(echo "$1" | cut -c1) = "-" ]; then + echo "$0: assuming arguments for groestlcoind" + + set -- groestlcoind "$@" +fi + +if [ $(echo "$1" | cut -c1) = "-" ] || [ "$1" = "groestlcoind" ]; then + mkdir -p "$GROESTLCOIN_DATA" + chmod 700 "$GROESTLCOIN_DATA" + # Fix permissions for home dir. + chown -R groestlcoin:groestlcoin "$(getent passwd groestlcoin | cut -d: -f6)" + # Fix permissions for groestlcoin data dir. + chown -R groestlcoin:groestlcoin "$GROESTLCOIN_DATA" + + echo "$0: setting data directory to $GROESTLCOIN_DATA" + + set -- "$@" -datadir="$GROESTLCOIN_DATA" +fi + +if [ "$1" = "groestlcoind" ] || [ "$1" = "groestlcoin-cli" ] || [ "$1" = "groestlcoin-tx" ]; then + echo + exec su-exec groestlcoin "$@" +fi + +echo +exec "$@" diff --git a/27/docker-entrypoint.sh b/27/docker-entrypoint.sh new file mode 100644 index 0000000..54ad00a --- /dev/null +++ b/27/docker-entrypoint.sh @@ -0,0 +1,39 @@ +#!/bin/bash +set -e + +if [ -n "${UID+x}" ] && [ "${UID}" != "0" ]; then + usermod -u "$UID" groestlcoin +fi + +if [ -n "${GID+x}" ] && [ "${GID}" != "0" ]; then + groupmod -g "$GID" groestlcoin +fi + +echo "$0: assuming uid:gid for groestlcoin:groestlcoin of $(id -u groestlcoin):$(id -g groestlcoin)" + +if [ $(echo "$1" | cut -c1) = "-" ]; then + echo "$0: assuming arguments for groestlcoind" + + set -- groestlcoind "$@" +fi + +if [ $(echo "$1" | cut -c1) = "-" ] || [ "$1" = "groestlcoind" ]; then + mkdir -p "$GROESTLCOIN_DATA" + chmod 700 "$GROESTLCOIN_DATA" + # Fix permissions for home dir. + chown -R groestlcoin:groestlcoin "$(getent passwd groestlcoin | cut -d: -f6)" + # Fix permissions for groestlcoin data dir. + chown -R groestlcoin:groestlcoin "$GROESTLCOIN_DATA" + + echo "$0: setting data directory to $GROESTLCOIN_DATA" + + set -- "$@" -datadir="$GROESTLCOIN_DATA" +fi + +if [ "$1" = "groestlcoind" ] || [ "$1" = "groestlcoin-cli" ] || [ "$1" = "groestlcoin-tx" ]; then + echo + exec gosu groestlcoin "$@" +fi + +echo +exec "$@" diff --git a/README.md b/README.md index bf00682..6f4a04e 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,10 @@ A groestlcoin-core docker image with support for the following platforms: ## Tags -- `26`, `latest` ([26/Dockerfile](https://github.com/groestlcoin/docker-groestlcoin-core/blob/master/26/Dockerfile)) [**multi-arch**] +- `27`, `latest` ([27/Dockerfile](https://github.com/groestlcoin/docker-groestlcoin-core/blob/master/27/Dockerfile)) [**multi-arch**] +- `27-alpine` ([27/alpine/Dockerfile](https://github.com/groestlcoin/docker-groestlcoin-core/blob/master/27/alpine/Dockerfile)) + +- `26` ([26/Dockerfile](https://github.com/groestlcoin/docker-groestlcoin-core/blob/master/26/Dockerfile)) [**multi-arch**] - `26-alpine` ([26/alpine/Dockerfile](https://github.com/groestlcoin/docker-groestlcoin-core/blob/master/26/alpine/Dockerfile)) - `25` ([25/Dockerfile](https://github.com/groestlcoin/docker-groestlcoin-core/blob/master/25/Dockerfile)) [**multi-arch**]