Dockerfile and scripting improvements
This commit is contained in:
47
Dockerfile
47
Dockerfile
@@ -10,7 +10,8 @@ RUN \
|
||||
# Set up environment
|
||||
ENV LC_ALL=C.UTF-8
|
||||
ENV LANG=C.UTF-8
|
||||
ENV MIX_ENV=prod
|
||||
ARG MIX_ENV
|
||||
ENV MIX_ENV=$MIX_ENV
|
||||
|
||||
# Prepare mounts
|
||||
VOLUME /custom.d
|
||||
@@ -22,12 +23,14 @@ EXPOSE 4000
|
||||
RUN \
|
||||
apk add --no-cache --virtual .tools \
|
||||
git curl rsync postgresql-client \
|
||||
\
|
||||
&& apk add --no-cache --virtual .sdk \
|
||||
&& \
|
||||
apk add --no-cache --virtual .sdk \
|
||||
build-base \
|
||||
\
|
||||
&& apk add --no-cache --virtual .runtime \
|
||||
imagemagick erlang erlang-runtime-tools erlang-xmerl erlang-ssl erlang-eldap elixir
|
||||
&& \
|
||||
apk add --no-cache --virtual .runtime \
|
||||
imagemagick \
|
||||
elixir erlang erlang-runtime-tools \
|
||||
erlang-xmerl erlang-ssl erlang-ssh erlang-eldap
|
||||
|
||||
# Add entrypoint
|
||||
COPY ./entrypoint.sh /
|
||||
@@ -35,21 +38,25 @@ RUN chmod a+x /entrypoint.sh
|
||||
ENTRYPOINT ["/entrypoint.sh"]
|
||||
|
||||
# Limit permissions
|
||||
ARG DOCKER_UID=1000
|
||||
ARG DOCKER_GID=1000
|
||||
ARG PLEROMA_UPLOADS_PATH=/uploads
|
||||
ARG DOCKER_UID
|
||||
ARG DOCKER_GID
|
||||
|
||||
RUN \
|
||||
addgroup -g ${DOCKER_GID} pleroma \
|
||||
&& adduser -S -s /bin/ash -G pleroma -u ${DOCKER_UID} pleroma \
|
||||
&& mkdir -p /custom.d $PLEROMA_UPLOADS_PATH \
|
||||
&& chown -R pleroma:pleroma /custom.d $PLEROMA_UPLOADS_PATH
|
||||
echo "#> Pleroma user will be ${DOCKER_UID}:${DOCKER_GID}" 1>&2 && \
|
||||
addgroup -g ${DOCKER_GID} pleroma && \
|
||||
adduser -S -s /bin/ash -G pleroma -u ${DOCKER_UID} pleroma && \
|
||||
mkdir -p /custom.d /uploads && \
|
||||
chown -R pleroma:pleroma /custom.d /uploads
|
||||
|
||||
USER pleroma
|
||||
WORKDIR /home/pleroma
|
||||
|
||||
# Get pleroma sources
|
||||
RUN git clone --progress https://git.pleroma.social/pleroma/pleroma.git ./pleroma
|
||||
ARG PLEROMA_GIT_REPO
|
||||
RUN \
|
||||
echo "#> Getting pleroma sources from $PLEROMA_GIT_REPO..." 1>&2 && \
|
||||
git clone --progress $PLEROMA_GIT_REPO ./pleroma
|
||||
|
||||
WORKDIR /home/pleroma/pleroma
|
||||
|
||||
# Bust the build cache (if needed)
|
||||
@@ -63,12 +70,12 @@ ENV __CACHE_TAG $__CACHE_TAG
|
||||
# Fetch changes, checkout
|
||||
ARG PLEROMA_VERSION
|
||||
RUN \
|
||||
git fetch --all \
|
||||
&& git checkout $PLEROMA_VERSION \
|
||||
&& git pull --rebase --autostash
|
||||
git fetch --all && \
|
||||
git checkout $PLEROMA_VERSION && \
|
||||
git pull --rebase --autostash
|
||||
|
||||
# Precompile
|
||||
RUN \
|
||||
cp ./config/dev.exs ./config/prod.secret.exs \
|
||||
&& BUILDTIME=1 /entrypoint.sh \
|
||||
&& rm ./config/prod.secret.exs
|
||||
cp ./config/dev.exs ./config/prod.secret.exs && \
|
||||
BUILDTIME=1 /entrypoint.sh && \
|
||||
rm ./config/prod.secret.exs
|
||||
|
Reference in New Issue
Block a user