Switch to debian 9

This commit is contained in:
sn0w 2018-08-20 23:06:47 +02:00
parent 1abd956c1a
commit 30ef913c40
2 changed files with 38 additions and 26 deletions

View File

@ -1,16 +1,15 @@
FROM elixir:1.7-slim FROM debian:9-slim
ENV DEBIAN_FRONTEND=noninteractive
ENV LANG=C.UTF-8
ENV MIX_ENV=prod
VOLUME /custom.d VOLUME /custom.d
EXPOSE 4000 EXPOSE 4000
ENV DEBIAN_FRONTEND=noninteractive
ENV LC_ALL=C.UTF-8
ENV LANG=C.UTF-8
# Register pseudo-entrypoint # Register pseudo-entrypoint
ADD ./entrypoint.sh / ADD ./entrypoint.sh /
RUN chmod +x /entrypoint.sh RUN chmod a+x /entrypoint.sh
CMD ["/entrypoint.sh"] CMD ["/entrypoint.sh"]
# Set "real" entrypoint to an init system. # Set "real" entrypoint to an init system.
@ -20,32 +19,41 @@ ADD https://github.com/krallin/tini/releases/download/${TINI_VERSION}/tini /tini
RUN chmod +x /tini RUN chmod +x /tini
ENTRYPOINT ["/tini", "--"] ENTRYPOINT ["/tini", "--"]
# Get git # Get build dependencies
RUN \ RUN \
apt-get update \ apt-get update \
&& apt-get install -y --no-install-recommends git ca-certificates \ && 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 \
&& rm -rf /var/lib/apt/lists/* && rm -rf /var/lib/apt/lists/*
# Limit rights # Limit permissions
ARG DOCKER_UID ARG DOCKER_UID
ARG DOCKER_GID ARG DOCKER_GID
ARG PLEROMA_UPLOADS_PATH ARG PLEROMA_UPLOADS_PATH
RUN \ RUN \
addgroup --gid ${DOCKER_GID} pleroma \ groupadd --gid ${DOCKER_GID} pleroma \
&& adduser --system --home /pleroma --shell /bin/bash --ingroup pleroma --uid ${DOCKER_UID} pleroma \ && useradd -m -s /bin/bash --gid ${DOCKER_GID} --uid ${DOCKER_UID} pleroma \
&& mkdir -p /pleroma /custom.d $PLEROMA_UPLOADS_PATH \ && mkdir -p /custom.d $PLEROMA_UPLOADS_PATH \
&& touch /pleroma.md5 \ && chown -R pleroma:pleroma /custom.d $PLEROMA_UPLOADS_PATH
&& chown -R pleroma:pleroma /pleroma /pleroma.md5 /custom.d $PLEROMA_UPLOADS_PATH
USER pleroma USER pleroma
WORKDIR /home/pleroma
# Get the sources and rebar/hex # Inject runtime config helper
ARG PLEROMA_VERSION COPY --chown=pleroma:pleroma ./docker-config.exs /docker-config.exs
WORKDIR /pleroma
# Get pleroma
RUN git clone --progress https://git.pleroma.social/pleroma/pleroma.git ./pleroma
WORKDIR /home/pleroma/pleroma
RUN \ RUN \
git clone --progress https://git.pleroma.social/pleroma/pleroma.git . \ ln -s /docker-config.exs config/prod.secret.exs \
&& ln -s /docker-config.exs config/dev.secret.exs \
&& mix local.hex --force \ && mix local.hex --force \
&& mix local.rebar --force && mix local.rebar --force
@ -54,16 +62,20 @@ ARG __BUST_CACHE
ENV __BUST_CACHE $__BUST_CACHE ENV __BUST_CACHE $__BUST_CACHE
# Fetch changes, checkout # Fetch changes, checkout
ARG PLEROMA_VERSION
RUN \ RUN \
git fetch --all \ git fetch --all \
&& git checkout $PLEROMA_VERSION \ && git checkout $PLEROMA_VERSION \
&& git pull --rebase --autostash && git pull --rebase --autostash
# Modify sources # Insert overrides
ADD ./docker-config.exs /docker-config.exs COPY --chown=pleroma:pleroma ./custom.d /pleroma
# Precompile
RUN \ RUN \
ln -s /docker-config.exs config/prod.secret.exs && \ mix deps.get \
ln -s /docker-config.exs config/dev.secret.exs && mix compile
ADD ./custom.d /pleroma # Disable dev-mode
ENV MIX_ENV=prod

View File

@ -124,7 +124,7 @@ action__debug() {
action__stop action__stop
docker_compose run --rm -u pleroma -w /pleroma $debug_mounts server bash -c 'mix deps.get && mix compile' docker_compose run --rm -u pleroma -w /home/pleroma/pleroma $debug_mounts server bash -c 'mix deps.get && mix compile'
x_flags="" x_flags=""
if [[ $NO_X_FORWARDING != 1 ]]; then if [[ $NO_X_FORWARDING != 1 ]]; then
@ -132,7 +132,7 @@ action__debug() {
fi fi
[[ $NO_X_FORWARDING == 1 ]] || xhost +local:root [[ $NO_X_FORWARDING == 1 ]] || xhost +local:root
docker_compose run --rm -u pleroma -w /pleroma $debug_mounts $x_flags server bash -c "cp -rf /custom.d/* /pleroma && $*" docker_compose run --rm -u pleroma -w /home/pleroma/pleroma $debug_mounts $x_flags server bash -c "cp -rf /custom.d/* /pleroma && $*"
[[ $NO_X_FORWARDING == 1 ]] || xhost -local:root [[ $NO_X_FORWARDING == 1 ]] || xhost -local:root
} }