From dadd12f8d435a7fc639bb2fe280b45fc1885886e Mon Sep 17 00:00:00 2001 From: meliurwen Date: Thu, 23 Dec 2021 12:21:53 +0100 Subject: [PATCH] Polished atheme Dockerfile --- atheme/Dockerfile | 57 ++++++++++++++------------------------- atheme/root/entrypoint.sh | 19 +------------ solanum/Dockerfile | 3 ++- 3 files changed, 23 insertions(+), 56 deletions(-) diff --git a/atheme/Dockerfile b/atheme/Dockerfile index ca1abc2..bfde883 100644 --- a/atheme/Dockerfile +++ b/atheme/Dockerfile @@ -1,55 +1,38 @@ -ARG ATHEME_UID=10000 -ARG ATHEME_VERSION=7.2.10-r2 -ARG BUILD_CONTRIB_MODULES= +ARG AT_VERSION=7.2.10-r2 FROM alpine:latest AS builder -ARG ATHEME_VERSION -ARG BUILD_CONTRIB_MODULES -ARG MAKE_NUM_JOBS - -# Install build-deps and runtime deps -RUN apk add --no-cache \ - build-base \ - pkgconf \ - openssl-dev \ - git - -# libexecinfo is used by contrib/gen_echoserver -RUN test -z "$BUILD_CONTRIB_MODULES" || apk add --no-cache libexecinfo-dev - -# Checkout from Git - we need to manually bump the libmowgli snapshot to fix compilation against musl -# This will be fixed when 7.3 releases +ARG AT_VERSION +ARG MK_THREADS + +RUN apk --update add \ + git RUN git clone \ - -b v${ATHEME_VERSION} \ + -b v${AT_VERSION} \ --depth=1 \ - --recursive \ + --recurse-submodules \ + -j2 \ https://github.com/atheme/atheme.git /atheme-src WORKDIR /atheme-src +RUN apk add \ + g++ \ + pkgconfig +RUN ./configure \ + --prefix=/srv/atheme + RUN cd libmowgli-2 && \ git pull origin master -# Configure and build -RUN ./configure \ - --prefix=/srv/atheme $(test -z "$BUILD_CONTRIB_MODULES" || echo --enable-contrib) && \ - make -j${MAKE_NUM_JOBS:-$(nproc)} && \ +RUN apk add \ + make +RUN make -j${MK_THREADS:-$(nproc)} && \ make install FROM alpine:latest -ARG ATHEME_UID -ARG BUILD_CONTRIB_MODULES - -# openssl: used by some hashing and SASL algorithms -# msmtp: used to route mail to an external mail server -RUN apk add --no-cache \ - openssl \ - msmtp \ - ca-certificates \ - && (test -z "$BUILD_CONTRIB_MODULES" || apk add --no-cache libexecinfo) - -RUN adduser -D -u $ATHEME_UID atheme + +RUN adduser -D atheme COPY --from=builder --chown=atheme /srv/atheme /srv/atheme diff --git a/atheme/root/entrypoint.sh b/atheme/root/entrypoint.sh index 6ea9277..9f3a059 100755 --- a/atheme/root/entrypoint.sh +++ b/atheme/root/entrypoint.sh @@ -7,27 +7,10 @@ mkdir -p "$DATADIR" chown atheme:atheme -R "$DATADIR" if [ ! -e $DATADIR/atheme.conf ]; then - echo "Configuration file not found. Generating it..." + printf "Configuration file not found. Generating it..." cp /srv/atheme/etc/atheme.conf.example $DATADIR/atheme.conf fi -if ! test -w "$DATADIR/"; then - echo "ERROR: $DATADIR must be mounted to a directory writable by UID $ATHEME_UID" - exit 1 -fi - -DBPATH="$DATADIR/services.db" -if test -f "$DBPATH" && ! test -r "$DBPATH"; then - echo "ERROR: $DBPATH must be readable by UID $ATHEME_UID" - exit 1 -fi - -TMPPATH="$DATADIR/services.db.new" -if test -f "$TMPPATH" && ! test -w "$TMPPATH"; then - echo "ERROR: $TMPPATH must either not exist or be writable by UID $ATHEME_UID" - exit 1 -fi - rm -f /srv/atheme/var/atheme.pid su atheme -c "/srv/atheme/bin/atheme-services \ -c $DATADIR/atheme.conf \ diff --git a/solanum/Dockerfile b/solanum/Dockerfile index c92cd8c..0d50919 100644 --- a/solanum/Dockerfile +++ b/solanum/Dockerfile @@ -1,4 +1,5 @@ FROM alpine:latest AS builder +ARG MK_THREADS LABEL maintainer="Meliurwen " @@ -30,7 +31,7 @@ RUN ./configure \ RUN apk add \ util-linux -RUN make -j${MAKE_NUM_JOBS:-$(nproc)} && \ +RUN make -j${MK_THREADS:-$(nproc)} && \ make install