FROM elixir:1.9-alpine as build COPY . . ENV MIX_ENV=prod RUN apk add git gcc g++ musl-dev make cmake file-dev &&\ echo "import Mix.Config" > config/prod.secret.exs &&\ mix local.hex --force &&\ mix local.rebar --force &&\ mix deps.get --only prod &&\ mkdir release &&\ mix release --path release FROM alpine:3.11 ARG BUILD_DATE ARG VCS_REF ARG UID=911 ARG GID=911 LABEL maintainer="ops@pleroma.social" \ org.opencontainers.image.title="pleroma" \ org.opencontainers.image.description="Pleroma for Docker" \ org.opencontainers.image.authors="ops@pleroma.social" \ org.opencontainers.image.vendor="pleroma.social" \ org.opencontainers.image.documentation="https://git.pleroma.social/pleroma/pleroma" \ org.opencontainers.image.licenses="AGPL-3.0" \ org.opencontainers.image.url="https://pleroma.social" \ org.opencontainers.image.revision=$VCS_REF \ org.opencontainers.image.created=$BUILD_DATE ARG HOME=/opt/pleroma ARG DATA=/var/lib/pleroma RUN echo "http://nl.alpinelinux.org/alpine/latest-stable/community" >> /etc/apk/repositories &&\ apk update &&\ apk add exiftool ffmpeg imagemagick libmagic ncurses postgresql-client &&\ adduser --system --shell /bin/false -u $UID -g $GID --home ${HOME} 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:0 /release ${HOME} ENV PATH="${HOME}/bin:${PATH}" COPY ./config/docker.exs /etc/pleroma/config.exs EXPOSE 4000 CMD ["pleroma", "start"]