2018-08-20 21:06:47 +00:00
|
|
|
FROM debian:9-slim
|
2018-04-07 20:29:55 +00:00
|
|
|
|
2018-08-20 21:06:34 +00:00
|
|
|
VOLUME /custom.d
|
|
|
|
EXPOSE 4000
|
2018-04-09 09:55:52 +00:00
|
|
|
|
2018-08-20 21:06:47 +00:00
|
|
|
ENV DEBIAN_FRONTEND=noninteractive
|
|
|
|
ENV LC_ALL=C.UTF-8
|
|
|
|
ENV LANG=C.UTF-8
|
|
|
|
|
2018-08-20 21:06:34 +00:00
|
|
|
# Register pseudo-entrypoint
|
|
|
|
ADD ./entrypoint.sh /
|
2018-08-20 21:06:47 +00:00
|
|
|
RUN chmod a+x /entrypoint.sh
|
2018-08-20 21:06:34 +00:00
|
|
|
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", "--"]
|
|
|
|
|
2018-08-20 21:06:47 +00:00
|
|
|
# Get build dependencies
|
2018-08-20 21:06:34 +00:00
|
|
|
RUN \
|
|
|
|
apt-get update \
|
2018-08-20 21:06:47 +00:00
|
|
|
&& apt-get install -y --no-install-recommends git wget ca-certificates gnupg2 \
|
|
|
|
&& wget https://packages.erlang-solutions.com/erlang-solutions_1.0_all.deb \
|
|
|
|
&& dpkg -i erlang-solutions_1.0_all.deb \
|
|
|
|
&& apt-get update \
|
|
|
|
&& apt-get install -y --no-install-recommends esl-erlang elixir \
|
2018-08-20 21:06:34 +00:00
|
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
|
2018-08-20 21:06:47 +00:00
|
|
|
# Limit permissions
|
2018-08-20 21:06:34 +00:00
|
|
|
ARG DOCKER_UID
|
|
|
|
ARG DOCKER_GID
|
|
|
|
ARG PLEROMA_UPLOADS_PATH
|
|
|
|
|
|
|
|
RUN \
|
2018-08-20 21:06:47 +00:00
|
|
|
groupadd --gid ${DOCKER_GID} pleroma \
|
|
|
|
&& useradd -m -s /bin/bash --gid ${DOCKER_GID} --uid ${DOCKER_UID} pleroma \
|
|
|
|
&& mkdir -p /custom.d $PLEROMA_UPLOADS_PATH \
|
|
|
|
&& chown -R pleroma:pleroma /custom.d $PLEROMA_UPLOADS_PATH
|
2018-08-20 21:06:34 +00:00
|
|
|
|
|
|
|
USER pleroma
|
2018-08-20 21:06:47 +00:00
|
|
|
WORKDIR /home/pleroma
|
2018-08-20 21:06:34 +00:00
|
|
|
|
2018-08-20 21:06:47 +00:00
|
|
|
# Get pleroma
|
|
|
|
RUN git clone --progress https://git.pleroma.social/pleroma/pleroma.git ./pleroma
|
|
|
|
WORKDIR /home/pleroma/pleroma
|
2018-04-09 09:55:52 +00:00
|
|
|
|
2018-08-21 01:19:42 +00:00
|
|
|
# Get rebar/hex
|
2018-04-09 09:55:52 +00:00
|
|
|
RUN \
|
2018-08-21 01:19:42 +00:00
|
|
|
mix local.hex --force \
|
2018-08-20 21:06:34 +00:00
|
|
|
&& mix local.rebar --force
|
2018-04-08 14:15:44 +00:00
|
|
|
|
2018-08-20 21:06:34 +00:00
|
|
|
# Bust the build cache
|
|
|
|
ARG __BUST_CACHE
|
|
|
|
ENV __BUST_CACHE $__BUST_CACHE
|
|
|
|
|
|
|
|
# Fetch changes, checkout
|
2018-08-20 21:06:47 +00:00
|
|
|
ARG PLEROMA_VERSION
|
|
|
|
|
2018-08-20 21:06:34 +00:00
|
|
|
RUN \
|
|
|
|
git fetch --all \
|
|
|
|
&& git checkout $PLEROMA_VERSION \
|
|
|
|
&& git pull --rebase --autostash
|
2018-04-09 09:55:52 +00:00
|
|
|
|
2018-08-21 01:19:42 +00:00
|
|
|
# Insert overrides and config helper
|
|
|
|
COPY --chown=pleroma:pleroma ./docker-config.exs /docker-config.exs
|
|
|
|
COPY --chown=pleroma:pleroma ./custom.d /home/pleroma/pleroma
|
2018-04-07 20:29:55 +00:00
|
|
|
|
2018-08-20 21:06:47 +00:00
|
|
|
# Precompile
|
2018-08-20 21:06:34 +00:00
|
|
|
RUN \
|
2018-08-21 01:19:42 +00:00
|
|
|
ln -s /docker-config.exs config/prod.secret.exs \
|
|
|
|
&& ln -s /docker-config.exs config/dev.secret.exs \
|
|
|
|
&& mix deps.get \
|
2018-08-20 21:06:47 +00:00
|
|
|
&& mix compile
|