Skip to content
This repository has been archived by the owner on Jul 7, 2020. It is now read-only.

Commit

Permalink
Change build method to multistage build
Browse files Browse the repository at this point in the history
  • Loading branch information
orlea committed Jan 5, 2020
1 parent 1217975 commit 6b9df65
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 5 deletions.
34 changes: 30 additions & 4 deletions pleroma/Dockerfile
Expand Up @@ -4,7 +4,7 @@
# Copyright (c) 2018 Angristan


FROM elixir:1.9-alpine
FROM elixir:1.9-alpine AS build

ENV UID=911 GID=911 \
MIX_ENV=prod
Expand All @@ -25,7 +25,7 @@ RUN addgroup -g ${GID} pleroma \
&& adduser -h /pleroma -s /bin/sh -D -G pleroma -u ${UID} pleroma

USER pleroma
WORKDIR pleroma
WORKDIR /pleroma

RUN git clone -b develop https://git.pleroma.social/pleroma/pleroma.git /pleroma \
&& git checkout ${PLEROMA_VER}
Expand All @@ -38,6 +38,32 @@ RUN mix local.rebar --force \
&& mkdir release \
&& mix release --path release

VOLUME /pleroma/uploads/
FROM alpine:3.9

CMD ["./release/bin/pleroma", "start"]
ENV UID=911 GID=911

ARG HOME=/opt/pleroma
ARG DATA=/var/lib/pleroma

RUN apk -U upgrade \
&& apk add --no-cache \
imagemagick \
ncurses

RUN addgroup -g ${GID} pleroma \
&& adduser -h ${HOME} -s /bin/sh -D -G pleroma -u ${UID} pleroma \
&& mkdir -p ${DATA}/uploads \
&& mkdir -p ${DATA}/static \
&& chown -R pleroma ${DATA} \
&& mkdir -p /etc/pleroma \
&& chown -R pleroma /etc/pleroma

USER pleroma

COPY --from=build --chown=pleroma:pleroma /pleroma/release ${HOME}

RUN touch /etc/pleroma/config.exs

EXPOSE 4000

CMD ["/opt/pleroma/bin/pleroma", "start"]
2 changes: 1 addition & 1 deletion pleroma/script/pl-update.sh
Expand Up @@ -2,7 +2,7 @@
set -uxe

sudo docker-compose -f ~/pl.asterism.xyz/pleroma/pl-asterism-xyz.manage.yml pull
sudo docker-compose -f ~/pl.asterism.xyz/pleroma/pl-asterism-xyz.manage.yml run --rm web ./release/bin/pleroma_ctl migrate
sudo docker-compose -f ~/pl.asterism.xyz/pleroma/pl-asterism-xyz.manage.yml run --rm web /opt/pleroma/bin/pleroma_ctl migrate
sudo docker stack deploy pleroma -c ~/pl.asterism.xyz/pleroma/pl-asterism-xyz.yml
sudo docker system prune --force
sudo docker node ls |grep Ready|awk '$2{print$2}'|grep -v "*"|xargs -L 1 -I {} ssh user@{} -i ~/key.pem "sudo docker system prune --force"

0 comments on commit 6b9df65

Please sign in to comment.