Make building contrib modules an option & use multi-stage builds
This commit is contained in:
parent
3b2676a655
commit
97cfc97c90
1 changed files with 24 additions and 20 deletions
44
Dockerfile
44
Dockerfile
|
@ -1,42 +1,46 @@
|
||||||
FROM alpine:3.11
|
|
||||||
|
|
||||||
ARG ATHEME_VERSION=7.2.10-r2
|
|
||||||
ARG CONFIGURE_ARGS=--enable-contrib
|
|
||||||
ARG ATHEME_UID=10000
|
ARG ATHEME_UID=10000
|
||||||
|
ARG ATHEME_VERSION=7.2.10-r2
|
||||||
|
ARG BUILD_CONTRIB_MODULES=
|
||||||
|
|
||||||
RUN adduser -D -h /atheme -u $ATHEME_UID atheme
|
FROM alpine:latest AS builder
|
||||||
|
ARG ATHEME_VERSION
|
||||||
|
ARG BUILD_CONTRIB_MODULES
|
||||||
RUN mkdir /atheme-src
|
RUN mkdir /atheme-src
|
||||||
|
|
||||||
# Install build-deps
|
# Install build-deps and runtime deps
|
||||||
RUN apk add --no-cache --virtual .build-deps \
|
RUN apk add --no-cache \
|
||||||
build-base \
|
build-base \
|
||||||
pkgconf \
|
pkgconf \
|
||||||
openssl-dev \
|
openssl-dev \
|
||||||
# Used by contrib/gen_echoserver.so
|
|
||||||
libexecinfo-dev \
|
|
||||||
git
|
git
|
||||||
# Runtime deps
|
|
||||||
RUN apk add openssl libexecinfo
|
# 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
|
# Checkout from Git - we need to manually bump the libmowgli snapshot to fix compilation against musl
|
||||||
# This will be fixed when 7.3 releases
|
# This will be fixed when 7.3 releases
|
||||||
RUN git clone https://github.com/atheme/atheme -b v${ATHEME_VERSION} atheme-src --recursive
|
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
|
RUN cd /atheme-src/libmowgli-2 && \
|
||||||
|
git pull origin master
|
||||||
|
|
||||||
# Configure and build
|
# Configure and build
|
||||||
RUN cd /atheme-src && \
|
RUN cd /atheme-src && \
|
||||||
./configure --prefix=/atheme $CONFIGURE_ARGS
|
./configure --prefix=/atheme $(test -z "$BUILD_CONTRIB_MODULES" || echo --enable-contrib) && \
|
||||||
RUN cd /atheme-src && \
|
|
||||||
make -j$(nproc) && make install
|
make -j$(nproc) && make install
|
||||||
|
|
||||||
# Remove source dir and build deps
|
|
||||||
RUN rm -rf /atheme-src && apk del .build-deps
|
|
||||||
|
|
||||||
|
FROM alpine:latest
|
||||||
|
ARG ATHEME_UID
|
||||||
|
ARG BUILD_CONTRIB_MODULES
|
||||||
|
|
||||||
|
RUN apk add --no-cache openssl && (test -z "$BUILD_CONTRIB_MODULES" || apk add --no-cache libexecinfo)
|
||||||
|
|
||||||
|
COPY --from=builder /atheme/ /atheme
|
||||||
|
RUN adduser -D -h /atheme -u $ATHEME_UID atheme
|
||||||
RUN chown -R atheme /atheme
|
RUN chown -R atheme /atheme
|
||||||
USER atheme
|
USER atheme
|
||||||
# Services config
|
|
||||||
|
# Services config & DB
|
||||||
VOLUME /atheme/etc
|
VOLUME /atheme/etc
|
||||||
# Services DB
|
|
||||||
VOLUME /atheme/var
|
|
||||||
|
|
||||||
ENTRYPOINT ["/atheme/bin/atheme-services", "-n"]
|
ENTRYPOINT ["/atheme/bin/atheme-services", "-n"]
|
||||||
|
|
Loading…
Reference in a new issue