2018-08-20 17:06:34 -04:00
|
|
|
FROM elixir:1.7-slim
|
2018-04-07 16:29:55 -04:00
|
|
|
|
2018-08-20 17:06:34 -04:00
|
|
|
ENV DEBIAN_FRONTEND=noninteractive
|
|
|
|
ENV LANG=C.UTF-8
|
|
|
|
ENV MIX_ENV=prod
|
2018-04-07 16:29:55 -04:00
|
|
|
|
2018-08-20 17:06:34 -04:00
|
|
|
VOLUME /custom.d
|
2018-04-08 16:49:07 -04:00
|
|
|
|
2018-08-20 17:06:34 -04:00
|
|
|
EXPOSE 4000
|
2018-04-09 05:55:52 -04:00
|
|
|
|
2018-08-20 17:06:34 -04:00
|
|
|
# Register pseudo-entrypoint
|
|
|
|
ADD ./entrypoint.sh /
|
|
|
|
RUN chmod +x /entrypoint.sh
|
|
|
|
CMD ["/entrypoint.sh"]
|
|
|
|
|
|
|
|
# Set "real" entrypoint to an init system.
|
|
|
|
# TODO: Replace with --init when docker 18.06 is GA
|
|
|
|
ENV TINI_VERSION v0.18.0
|
|
|
|
ADD https://github.com/krallin/tini/releases/download/${TINI_VERSION}/tini /tini
|
|
|
|
RUN chmod +x /tini
|
|
|
|
ENTRYPOINT ["/tini", "--"]
|
|
|
|
|
|
|
|
# Get git
|
|
|
|
RUN \
|
|
|
|
apt-get update \
|
|
|
|
&& apt-get install -y --no-install-recommends git ca-certificates \
|
|
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
|
|
|
|
# Limit rights
|
|
|
|
ARG DOCKER_UID
|
|
|
|
ARG DOCKER_GID
|
|
|
|
ARG PLEROMA_UPLOADS_PATH
|
|
|
|
|
|
|
|
RUN \
|
|
|
|
addgroup --gid ${DOCKER_GID} pleroma \
|
|
|
|
&& adduser --system --home /pleroma --shell /bin/bash --ingroup pleroma --uid ${DOCKER_UID} pleroma \
|
|
|
|
&& mkdir -p /pleroma /custom.d $PLEROMA_UPLOADS_PATH \
|
|
|
|
&& touch /pleroma.md5 \
|
|
|
|
&& chown -R pleroma:pleroma /pleroma /pleroma.md5 /custom.d $PLEROMA_UPLOADS_PATH
|
|
|
|
|
|
|
|
USER pleroma
|
|
|
|
|
|
|
|
# Get the sources and rebar/hex
|
2018-04-08 16:49:07 -04:00
|
|
|
ARG PLEROMA_VERSION
|
2018-06-07 07:51:12 -04:00
|
|
|
WORKDIR /pleroma
|
2018-04-09 05:55:52 -04:00
|
|
|
|
|
|
|
RUN \
|
2018-08-20 17:06:34 -04:00
|
|
|
git clone --progress https://git.pleroma.social/pleroma/pleroma.git . \
|
|
|
|
&& mix local.hex --force \
|
|
|
|
&& mix local.rebar --force
|
2018-04-08 10:15:44 -04:00
|
|
|
|
2018-08-20 17:06:34 -04:00
|
|
|
# Bust the build cache
|
|
|
|
ARG __BUST_CACHE
|
|
|
|
ENV __BUST_CACHE $__BUST_CACHE
|
|
|
|
|
|
|
|
# Fetch changes, checkout
|
|
|
|
RUN \
|
|
|
|
git fetch --all \
|
|
|
|
&& git checkout $PLEROMA_VERSION \
|
|
|
|
&& git pull --rebase --autostash
|
2018-04-09 05:55:52 -04:00
|
|
|
|
2018-08-20 17:06:34 -04:00
|
|
|
# Modify sources
|
|
|
|
ADD ./docker-config.exs /docker-config.exs
|
2018-04-07 16:29:55 -04:00
|
|
|
|
2018-08-20 17:06:34 -04:00
|
|
|
RUN \
|
|
|
|
ln -s /docker-config.exs config/prod.secret.exs && \
|
|
|
|
ln -s /docker-config.exs config/dev.secret.exs
|
2018-04-09 05:55:52 -04:00
|
|
|
|
2018-08-20 17:06:34 -04:00
|
|
|
ADD ./custom.d /pleroma
|