pleroma-docker/Dockerfile

75 lines
1.9 KiB
Docker
Raw Normal View History

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-12-24 22:21:16 +00:00
ENTRYPOINT ["/entrypoint.sh"]
2018-08-20 21:06:34 +00:00
2018-08-20 21:06:47 +00:00
# Get build dependencies
2018-08-20 21:06:34 +00:00
RUN \
apt-get update \
2018-12-20 01:44:16 +00: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 21:06:47 +00: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 22:20:17 +00:00
&& apt-get install -y ruby \
2018-12-20 01:44:16 +00:00
\
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-12-20 01:44:16 +00:00
# Precompile
RUN \
mix deps.get \
&& mix compile
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-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 \
2018-12-20 01:44:16 +00:00
&& ln -s /docker-config.exs config/dev.secret.exs