Skip to content
Permalink
Browse files

Change build method to multistage build

  • Loading branch information
orlea committed Jan 5, 2020
1 parent 1217975 commit 6b9df6547fa9af7ebc33acd33d386f1ef6055727
Showing with 31 additions and 5 deletions.
  1. +30 −4 pleroma/Dockerfile
  2. +1 −1 pleroma/script/pl-update.sh
@@ -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
@@ -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}
@@ -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,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.
You can’t perform that action at this time.