2022-04-22 20:35:35 +02:00
|
|
|
FROM alpine:3.15.4 AS build
|
|
|
|
ARG VERSION=master
|
|
|
|
|
|
|
|
RUN apk upgrade --update musl \
|
|
|
|
&& apk add \
|
|
|
|
autoconf \
|
|
|
|
automake \
|
|
|
|
bash \
|
|
|
|
build-base \
|
|
|
|
curl \
|
|
|
|
elixir \
|
|
|
|
erlang-odbc \
|
|
|
|
erlang-reltool \
|
|
|
|
expat-dev \
|
|
|
|
file \
|
|
|
|
gd-dev \
|
|
|
|
git \
|
|
|
|
jpeg-dev \
|
|
|
|
libpng-dev \
|
|
|
|
libwebp-dev \
|
|
|
|
linux-pam-dev \
|
|
|
|
openssl \
|
|
|
|
openssl-dev \
|
|
|
|
sqlite-dev \
|
|
|
|
yaml-dev \
|
|
|
|
zlib-dev
|
|
|
|
|
|
|
|
RUN mix local.hex --force \
|
|
|
|
&& mix local.rebar --force
|
|
|
|
|
2022-09-06 19:59:33 +02:00
|
|
|
COPY . ./ejabberd
|
|
|
|
|
2022-04-22 20:35:35 +02:00
|
|
|
WORKDIR ejabberd
|
|
|
|
|
2022-09-06 19:59:33 +02:00
|
|
|
RUN mv .github/container/ejabberdctl.template . \
|
2022-04-22 20:35:35 +02:00
|
|
|
&& ./autogen.sh \
|
|
|
|
&& ./configure --with-rebar=mix --enable-all \
|
2022-05-23 12:35:09 +02:00
|
|
|
&& make deps \
|
2022-04-22 20:35:35 +02:00
|
|
|
&& make rel
|
|
|
|
|
|
|
|
RUN cp -r _build/prod/rel/ejabberd/ /opt/ejabberd-$VERSION \
|
|
|
|
&& mkdir -p /opt/ejabberd \
|
|
|
|
&& mv /opt/ejabberd-$VERSION/conf /opt/ejabberd/conf
|
|
|
|
|
2022-05-06 16:22:31 +02:00
|
|
|
RUN BINPATH=$(dirname $(find /opt -name msgs))/bin/ \
|
2022-09-07 12:02:36 +02:00
|
|
|
&& mkdir -p $BINPATH \
|
2022-05-06 16:22:31 +02:00
|
|
|
&& cp tools/captcha*.sh $BINPATH
|
2022-04-22 20:35:35 +02:00
|
|
|
|
2022-09-12 11:42:54 +02:00
|
|
|
RUN [ ! -d .ejabberd-modules ] || cp -r .ejabberd-modules /opt/ejabberd/
|
|
|
|
|
2022-04-22 20:35:35 +02:00
|
|
|
RUN export PEM=/opt/ejabberd/conf/server.pem \
|
|
|
|
&& curl -o "/opt/ejabberd/conf/cacert.pem" 'https://curl.se/ca/cacert.pem' \
|
|
|
|
&& openssl req -x509 \
|
|
|
|
-batch \
|
|
|
|
-nodes \
|
|
|
|
-newkey rsa:4096 \
|
|
|
|
-keyout $PEM \
|
|
|
|
-out $PEM \
|
|
|
|
-days 3650 \
|
|
|
|
-subj "/CN=localhost" \
|
|
|
|
&& sed -i '/^loglevel:/a \ \
|
|
|
|
\nca_file: /opt/ejabberd/conf/cacert.pem \
|
|
|
|
\ncertfiles: \
|
|
|
|
\n - /opt/ejabberd/conf/server.pem' "/opt/ejabberd/conf/ejabberd.yml"
|
|
|
|
|
|
|
|
FROM alpine:3.15.4
|
|
|
|
ENV HOME=/opt/ejabberd
|
2022-09-07 11:43:34 +02:00
|
|
|
ARG VERSION=master
|
2022-04-22 20:35:35 +02:00
|
|
|
|
|
|
|
RUN apk upgrade --update musl \
|
|
|
|
&& apk add \
|
|
|
|
expat \
|
|
|
|
freetds \
|
|
|
|
gd \
|
|
|
|
jpeg \
|
|
|
|
libgd \
|
|
|
|
libpng \
|
|
|
|
libstdc++ \
|
|
|
|
libwebp \
|
|
|
|
linux-pam \
|
|
|
|
ncurses-libs \
|
|
|
|
openssl \
|
|
|
|
sqlite \
|
|
|
|
sqlite-libs \
|
|
|
|
unixodbc \
|
|
|
|
yaml \
|
|
|
|
zlib \
|
|
|
|
&& ln -fs /usr/lib/libtdsodbc.so.0 /usr/lib/libtdsodbc.so \
|
|
|
|
&& rm -rf /var/cache/apk/*
|
|
|
|
|
|
|
|
COPY --from=build /opt /opt
|
|
|
|
RUN echo -e \
|
|
|
|
"#!/bin/sh \
|
|
|
|
\n[ -z \$ERLANG_NODE_ARG ] && export ERLANG_NODE_ARG=ejabberd@localhost \
|
|
|
|
\nexport CONFIG_DIR=/opt/ejabberd/conf \
|
|
|
|
\nexport LOGS_DIR=/opt/ejabberd/logs \
|
|
|
|
\nexport SPOOL_DIR=/opt/ejabberd/database \
|
2022-09-07 11:43:34 +02:00
|
|
|
\nexec /opt/ejabberd-$VERSION/bin/ejabberdctl \"\$@\"" > /usr/local/bin/ejabberdctl \
|
2022-04-22 20:35:35 +02:00
|
|
|
&& chmod +x /usr/local/bin/ejabberdctl
|
|
|
|
|
|
|
|
RUN addgroup ejabberd -g 9000 \
|
|
|
|
&& adduser -s /bin/sh -D -G ejabberd ejabberd -u 9000 \
|
|
|
|
&& mkdir -p $HOME/conf $HOME/database $HOME/logs $HOME/upload \
|
|
|
|
&& chown -R ejabberd:ejabberd $HOME
|
|
|
|
|
|
|
|
HEALTHCHECK \
|
2022-05-24 20:34:16 +02:00
|
|
|
--interval=1m \
|
2022-04-22 20:35:35 +02:00
|
|
|
--timeout=5s \
|
|
|
|
--start-period=5s \
|
2022-05-24 20:34:16 +02:00
|
|
|
--retries=10 \
|
2022-04-22 20:35:35 +02:00
|
|
|
CMD /usr/local/bin/ejabberdctl status
|
|
|
|
|
|
|
|
WORKDIR $HOME
|
|
|
|
USER ejabberd
|
|
|
|
VOLUME ["$HOME/conf", "$HOME/database", "$HOME/logs", "$HOME/upload"]
|
|
|
|
EXPOSE 1883 4369-4399 5222 5269 5280 5443
|
|
|
|
|
|
|
|
ENTRYPOINT ["/usr/local/bin/ejabberdctl"]
|
|
|
|
CMD ["foreground"]
|