2018-08-20 17:06:47 -04:00
|
|
|
FROM debian:9-slim
|
2018-04-07 16:29:55 -04:00
|
|
|
|
2018-12-27 19:44:33 -05:00
|
|
|
# Set up environment
|
2019-01-09 15:23:53 -05:00
|
|
|
ENV MIX_ENV=prod
|
2018-08-20 17:06:47 -04:00
|
|
|
ENV DEBIAN_FRONTEND=noninteractive
|
|
|
|
ENV LC_ALL=C.UTF-8
|
|
|
|
ENV LANG=C.UTF-8
|
|
|
|
|
2018-12-30 08:29:51 -05:00
|
|
|
# Prepare mounts
|
2018-12-27 19:44:33 -05:00
|
|
|
VOLUME /custom.d
|
|
|
|
|
|
|
|
# Expose default pleroma port to host
|
|
|
|
EXPOSE 4000
|
|
|
|
|
|
|
|
# Get erlang, elixir, and 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 \
|
2018-12-27 19:44:33 -05:00
|
|
|
&& apt-get install -y --no-install-recommends git wget ca-certificates gnupg2 build-essential ruby \
|
2018-12-19 20:44:16 -05:00
|
|
|
\
|
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-19 20:44:16 -05:00
|
|
|
\
|
2018-08-20 17:06:34 -04:00
|
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
|
2018-12-30 08:29:51 -05:00
|
|
|
# Add entrypoint
|
|
|
|
COPY ./entrypoint.sh /
|
|
|
|
RUN chmod a+x /entrypoint.sh
|
|
|
|
ENTRYPOINT ["/entrypoint.sh"]
|
|
|
|
|
2018-08-20 17:06:47 -04:00
|
|
|
# Limit permissions
|
2018-12-27 19:44:33 -05:00
|
|
|
ARG DOCKER_UID=1000
|
|
|
|
ARG DOCKER_GID=1000
|
|
|
|
ARG PLEROMA_UPLOADS_PATH=/uploads
|
2018-08-20 17:06:34 -04:00
|
|
|
|
|
|
|
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 \
|
2019-01-09 15:23:53 -05:00
|
|
|
&& 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-12-27 19:44:33 -05:00
|
|
|
# Get pleroma sources
|
2018-08-20 17:06:47 -04:00
|
|
|
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-12-27 19:44:33 -05:00
|
|
|
# Bust the build cache (if needed)
|
|
|
|
# This works by setting an environment variable with the last
|
|
|
|
# used version/branch/tag/commitish/... which originates in the script.
|
|
|
|
# If the host doesn't have the required tool for "smart version detection"
|
|
|
|
# we'll just use the current timestamp here which forces a rebuild every time.
|
2019-01-10 12:24:29 -05:00
|
|
|
ARG __CACHE_TAG
|
|
|
|
ENV __CACHE_TAG $__CACHE_TAG
|
2018-12-27 19:44:33 -05:00
|
|
|
|
2018-08-20 17:06:34 -04:00
|
|
|
# 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 \
|
2019-01-09 15:23:53 -05:00
|
|
|
cp ./config/dev.exs ./config/prod.secret.exs \
|
|
|
|
&& BUILDTIME=1 /entrypoint.sh \
|
|
|
|
&& rm ./config/prod.secret.exs
|
2018-12-27 19:44:33 -05:00
|
|
|
|
|
|
|
# Insert overrides
|
|
|
|
COPY --chown=pleroma:pleroma ./custom.d /home/pleroma/pleroma
|