2
0
mirror of https://github.com/processone/docker-ejabberd synced 2024-11-12 07:10:41 +00:00
docker-ejabberd/ecs/Dockerfile

81 lines
2.2 KiB
Docker
Raw Normal View History

2018-01-12 09:49:34 +00:00
FROM ejabberd/mix as builder
ARG VERSION
ENV VERSION=${VERSION:-latest} \
MIX_ENV=prod
LABEL maintainer="ProcessOne <contact@process-one.net>" \
product="Ejabberd Community Server builder"
# Get ejabberd sources, dependencies, configuration
RUN git clone https://github.com/processone/ejabberd.git
WORKDIR /ejabberd
COPY vars.config .
COPY rel/*exs rel/
RUN git checkout ${VERSION/latest/HEAD} \
&& mix deps.get
# Compile
RUN mix do compile, release.init, release --env=prod
# Prepare runtime environment
RUN mkdir runtime \
&& tar -C runtime -zxf _build/prod/rel/ejabberd/releases/*/ejabberd.tar.gz \
&& cd runtime \
&& cp releases/*/start.boot bin \
&& echo 'beam_lib:strip_files(filelib:wildcard("lib/*/ebin/*beam")), init:stop().' | erts*/bin/erl -boot start_clean >/dev/null \
&& mv erts*/bin/* bin \
&& rm -rf releases erts* bin/*src bin/dialyzer bin/typer \
&& rm bin/ejabberd bin/ejabberd.bat bin/ejabberd_loader.sh
# Runtime container
2018-07-20 10:06:28 +00:00
FROM alpine:3.8
2017-12-29 17:33:18 +00:00
ARG VERSION
ENV TERM=xterm \
LC_ALL=C.UTF-8 \
LANG=en_US.UTF-8 \
LANGUAGE=en_US.UTF-8 \
REPLACE_OS_VARS=true \
HOME=/home/ejabberd \
VERSION=${VERSION:-latest}
2017-12-29 17:33:18 +00:00
LABEL maintainer="ProcessOne <contact@process-one.net>" \
product="Ejabberd Community Server" \
2017-12-29 17:33:18 +00:00
version=$VERSION
# Create directory structure and user for ejabberd
RUN addgroup ejabberd -g 9000 \
&& adduser -s /bin/sh -D -G ejabberd ejabberd -u 9000 \
2018-01-12 09:49:34 +00:00
&& mkdir -p /home/ejabberd/conf /home/ejabberd/database /home/ejabberd/logs \
2017-12-29 17:33:18 +00:00
&& chown -R ejabberd:ejabberd /home/ejabberd
# Install required dependencies
RUN apk upgrade --update musl \
&& apk add \
expat \
2018-01-16 21:43:59 +00:00
gd \
jpeg \
libpng \
libstdc++ \
2018-01-16 21:43:59 +00:00
libwebp \
ncurses-libs \
openssl \
sqlite \
2018-10-18 11:27:16 +00:00
unixodbc \
yaml \
zlib \
2018-01-12 09:49:34 +00:00
&& rm -rf /var/cache/apk/*
2017-12-29 17:33:18 +00:00
# Install ejabberd
2018-01-12 09:49:34 +00:00
WORKDIR $HOME
COPY --from=builder /ejabberd/runtime .
COPY bin/* bin/
RUN chmod 755 bin/ejabberdctl bin/ejabberdapi bin/erl
2018-01-12 09:49:34 +00:00
COPY --chown=ejabberd:ejabberd conf conf/
2018-10-18 11:27:16 +00:00
ADD --chown=ejabberd:ejabberd https://download.process-one.net/cacert.pem conf/cacert.pem
2017-12-29 17:33:18 +00:00
# Set up runtime environment
2017-12-29 17:33:18 +00:00
USER ejabberd
2018-01-12 09:49:34 +00:00
VOLUME ["$HOME/database","$HOME/conf","$HOME/logs"]
2018-12-06 11:34:25 +00:00
EXPOSE 5222 5269 5443
2017-12-29 17:33:18 +00:00
2018-01-12 09:49:34 +00:00
ENTRYPOINT ["/home/ejabberd/bin/ejabberdctl"]
CMD ["foreground"]