2018-08-20 17:06:47 -04:00
|
|
|
FROM debian:9-slim
|
2018-04-07 16:29:55 -04:00
|
|
|
|
2018-08-20 17:06:34 -04:00
|
|
|
VOLUME /custom.d
|
|
|
|
EXPOSE 4000
|
2018-04-09 05:55:52 -04:00
|
|
|
|
2018-08-20 17:06:47 -04:00
|
|
|
ENV DEBIAN_FRONTEND=noninteractive
|
|
|
|
ENV LC_ALL=C.UTF-8
|
|
|
|
ENV LANG=C.UTF-8
|
|
|
|
|
2018-08-20 17:06:34 -04:00
|
|
|
# Register pseudo-entrypoint
|
|
|
|
ADD ./entrypoint.sh /
|
2018-08-20 17:06:47 -04:00
|
|
|
RUN chmod a+x /entrypoint.sh
|
2018-12-24 17:21:16 -05:00
|
|
|
ENTRYPOINT ["/entrypoint.sh"]
|
2018-08-20 17:06:34 -04:00
|
|
|
|
2018-08-20 17:06:47 -04:00
|
|
|
# Get build dependencies
|
2018-08-20 17:06:34 -04:00
|
|
|
RUN \
|
|
|
|
apt-get update \
|
2018-12-19 20:44:16 -05:00
|
|
|
&& apt-get install -y --no-install-recommends apt-utils \
|
|
|
|
&& apt-get install -y --no-install-recommends git wget ca-certificates gnupg2 build-essential \
|
|
|
|
\
|
2018-08-20 17:06:47 -04:00
|
|
|
&& 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-12-24 17:20:17 -05:00
|
|
|
&& apt-get install -y ruby \
|
2018-12-19 20:44:16 -05:00
|
|
|
\
|
2018-08-20 17:06:34 -04:00
|
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
|
2018-08-20 17:06:47 -04:00
|
|
|
# Limit permissions
|
2018-08-20 17:06:34 -04:00
|
|
|
ARG DOCKER_UID
|
|
|
|
ARG DOCKER_GID
|
|
|
|
ARG PLEROMA_UPLOADS_PATH
|
|
|
|
|
|
|
|
RUN \
|
2018-08-20 17:06:47 -04: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 17:06:34 -04:00
|
|
|
|
|
|
|
USER pleroma
|
2018-08-20 17:06:47 -04:00
|
|
|
WORKDIR /home/pleroma
|
2018-08-20 17:06:34 -04:00
|
|
|
|
2018-08-20 17:06:47 -04:00
|
|
|
# Get pleroma
|
|
|
|
RUN git clone --progress https://git.pleroma.social/pleroma/pleroma.git ./pleroma
|
|
|
|
WORKDIR /home/pleroma/pleroma
|
2018-04-09 05:55:52 -04:00
|
|
|
|
2018-08-20 21:19:42 -04:00
|
|
|
# Get rebar/hex
|
2018-04-09 05:55:52 -04:00
|
|
|
RUN \
|
2018-08-20 21:19:42 -04:00
|
|
|
mix local.hex --force \
|
2018-08-20 17:06:34 -04:00
|
|
|
&& 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
|
2018-08-20 17:06:47 -04:00
|
|
|
ARG PLEROMA_VERSION
|
|
|
|
|
2018-08-20 17:06:34 -04:00
|
|
|
RUN \
|
|
|
|
git fetch --all \
|
|
|
|
&& git checkout $PLEROMA_VERSION \
|
|
|
|
&& git pull --rebase --autostash
|
2018-04-09 05:55:52 -04:00
|
|
|
|
2018-12-19 20:44:16 -05:00
|
|
|
# Precompile
|
|
|
|
RUN \
|
|
|
|
mix deps.get \
|
|
|
|
&& mix compile
|
|
|
|
|
2018-08-20 21:19:42 -04: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-08-20 17:06:34 -04:00
|
|
|
RUN \
|
2018-08-20 21:19:42 -04:00
|
|
|
ln -s /docker-config.exs config/prod.secret.exs \
|
2018-12-19 20:44:16 -05:00
|
|
|
&& ln -s /docker-config.exs config/dev.secret.exs
|