2019-01-10 18:03:52 +00:00
|
|
|
FROM alpine:3.8
|
2018-04-07 20:29:55 +00:00
|
|
|
|
2018-12-28 00:44:33 +00:00
|
|
|
# Set up environment
|
2018-08-20 21:06:47 +00:00
|
|
|
ENV LC_ALL=C.UTF-8
|
|
|
|
ENV LANG=C.UTF-8
|
2019-01-10 18:03:52 +00:00
|
|
|
ENV MIX_ENV=prod
|
2018-08-20 21:06:47 +00:00
|
|
|
|
2018-12-30 13:29:51 +00:00
|
|
|
# Prepare mounts
|
2018-12-28 00:44:33 +00:00
|
|
|
VOLUME /custom.d
|
|
|
|
|
|
|
|
# Expose default pleroma port to host
|
|
|
|
EXPOSE 4000
|
|
|
|
|
2019-01-10 18:03:52 +00:00
|
|
|
# Get dependencies
|
2018-08-20 21:06:34 +00:00
|
|
|
RUN \
|
2019-01-10 18:03:52 +00:00
|
|
|
apk add --no-cache --virtual .tools \
|
2019-01-10 18:49:47 +00:00
|
|
|
git curl rsync postgresql-client \
|
2018-12-20 01:44:16 +00:00
|
|
|
\
|
2019-01-10 18:03:52 +00:00
|
|
|
&& apk add --no-cache --virtual .sdk \
|
|
|
|
build-base \
|
2018-12-20 01:44:16 +00:00
|
|
|
\
|
2019-01-10 18:03:52 +00:00
|
|
|
&& apk add --no-cache --virtual .runtime \
|
2019-01-20 12:02:42 +00:00
|
|
|
--repository=http://dl-cdn.alpinelinux.org/alpine/edge/main \
|
|
|
|
--repository=http://dl-cdn.alpinelinux.org/alpine/edge/community \
|
|
|
|
--force-overwrite \
|
2019-01-10 18:03:52 +00:00
|
|
|
erlang erlang-runtime-tools erlang-xmerl elixir
|
2018-08-20 21:06:34 +00:00
|
|
|
|
2018-12-30 13:29:51 +00:00
|
|
|
# Add entrypoint
|
|
|
|
COPY ./entrypoint.sh /
|
|
|
|
RUN chmod a+x /entrypoint.sh
|
|
|
|
ENTRYPOINT ["/entrypoint.sh"]
|
|
|
|
|
2018-08-20 21:06:47 +00:00
|
|
|
# Limit permissions
|
2018-12-28 00:44:33 +00:00
|
|
|
ARG DOCKER_UID=1000
|
|
|
|
ARG DOCKER_GID=1000
|
|
|
|
ARG PLEROMA_UPLOADS_PATH=/uploads
|
2018-08-20 21:06:34 +00:00
|
|
|
|
|
|
|
RUN \
|
2019-01-20 12:02:42 +00:00
|
|
|
addgroup -g ${DOCKER_GID} pleroma \
|
2019-01-10 18:03:52 +00:00
|
|
|
&& adduser -S -s /bin/ash -G pleroma -u ${DOCKER_UID} pleroma \
|
2018-08-20 21:06:47 +00:00
|
|
|
&& mkdir -p /custom.d $PLEROMA_UPLOADS_PATH \
|
2019-01-09 20:23:53 +00:00
|
|
|
&& 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-12-28 00:44:33 +00:00
|
|
|
# Get pleroma sources
|
2018-08-20 21:06:47 +00:00
|
|
|
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-12-28 00:44:33 +00: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 17:24:29 +00:00
|
|
|
ARG __CACHE_TAG
|
|
|
|
ENV __CACHE_TAG $__CACHE_TAG
|
2018-12-28 00:44:33 +00:00
|
|
|
|
2018-08-20 21:06:34 +00:00
|
|
|
# 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 \
|
2019-01-09 20:23:53 +00:00
|
|
|
cp ./config/dev.exs ./config/prod.secret.exs \
|
|
|
|
&& BUILDTIME=1 /entrypoint.sh \
|
|
|
|
&& rm ./config/prod.secret.exs
|
2018-12-28 00:44:33 +00:00
|
|
|
|
|
|
|
# Insert overrides
|
|
|
|
COPY --chown=pleroma:pleroma ./custom.d /home/pleroma/pleroma
|