2020-02-23 21:52:57 -08:00
|
|
|
ARG ATHEME_UID=10000
|
2022-02-01 15:45:24 -08:00
|
|
|
ARG ATHEME_VERSION
|
2020-02-23 22:27:22 -08:00
|
|
|
ARG BUILD_CONTRIB_MODULES=
|
2020-02-23 21:52:57 -08:00
|
|
|
|
2020-02-23 22:27:22 -08:00
|
|
|
FROM alpine:latest AS builder
|
|
|
|
ARG ATHEME_VERSION
|
|
|
|
ARG BUILD_CONTRIB_MODULES
|
2021-02-07 12:19:56 -08:00
|
|
|
ARG MAKE_NUM_JOBS
|
2022-02-01 15:45:24 -08:00
|
|
|
RUN test -n "$ATHEME_VERSION" || (echo "Please set a version to build in build arg ATHEME_VERSION" && false)
|
|
|
|
|
2020-02-23 21:52:57 -08:00
|
|
|
RUN mkdir /atheme-src
|
|
|
|
|
2020-02-23 22:27:22 -08:00
|
|
|
# Install build-deps and runtime deps
|
|
|
|
RUN apk add --no-cache \
|
2020-02-23 21:52:57 -08:00
|
|
|
build-base \
|
|
|
|
pkgconf \
|
|
|
|
openssl-dev \
|
|
|
|
git
|
2020-02-23 22:27:22 -08:00
|
|
|
|
|
|
|
# libexecinfo is used by contrib/gen_echoserver
|
|
|
|
RUN test -z "$BUILD_CONTRIB_MODULES" || apk add --no-cache libexecinfo-dev
|
2020-02-23 21:52:57 -08:00
|
|
|
|
|
|
|
# Checkout from Git - we need to manually bump the libmowgli snapshot to fix compilation against musl
|
|
|
|
# This will be fixed when 7.3 releases
|
2020-02-23 22:27:22 -08:00
|
|
|
RUN git clone https://github.com/atheme/atheme -b v${ATHEME_VERSION} --depth=1 atheme-src --recursive
|
|
|
|
RUN cd /atheme-src/libmowgli-2 && \
|
|
|
|
git pull origin master
|
2020-02-23 21:52:57 -08:00
|
|
|
|
2022-02-01 16:40:02 -08:00
|
|
|
# 2022-02-01: build fix for alpine
|
|
|
|
RUN test -z "$BUILD_CONTRIB_MODULES" || sed -i "s/@MKDIR_P@/mkdir -p/g" /atheme-src/modules/contrib/buildsys.mk.in
|
|
|
|
|
2020-02-23 21:52:57 -08:00
|
|
|
# Configure and build
|
|
|
|
RUN cd /atheme-src && \
|
2020-02-23 22:27:22 -08:00
|
|
|
./configure --prefix=/atheme $(test -z "$BUILD_CONTRIB_MODULES" || echo --enable-contrib) && \
|
2021-02-07 12:19:56 -08:00
|
|
|
make -j${MAKE_NUM_JOBS:-$(nproc)} && make install
|
2020-02-23 21:52:57 -08:00
|
|
|
|
|
|
|
|
2020-02-23 22:27:22 -08:00
|
|
|
FROM alpine:latest
|
|
|
|
ARG ATHEME_UID
|
|
|
|
ARG BUILD_CONTRIB_MODULES
|
|
|
|
|
2020-03-07 16:43:02 -08:00
|
|
|
# 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)
|
2020-02-23 22:27:22 -08:00
|
|
|
|
|
|
|
COPY --from=builder /atheme/ /atheme
|
2020-03-01 13:19:05 -08:00
|
|
|
|
|
|
|
# Add custom entrypoint to check that data dir is writable - Atheme does not check this by itself
|
|
|
|
RUN echo "$ATHEME_UID" > /.atheme_uid
|
|
|
|
COPY entrypoint.sh /
|
|
|
|
|
2020-02-23 22:27:22 -08:00
|
|
|
RUN adduser -D -h /atheme -u $ATHEME_UID atheme
|
2020-02-23 21:52:57 -08:00
|
|
|
RUN chown -R atheme /atheme
|
|
|
|
USER atheme
|
2020-02-23 22:27:22 -08:00
|
|
|
|
|
|
|
# Services config & DB
|
2020-02-23 21:52:57 -08:00
|
|
|
VOLUME /atheme/etc
|
|
|
|
|
2020-03-01 13:19:05 -08:00
|
|
|
ENTRYPOINT ["/entrypoint.sh"]
|