Dockerfile 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. FROM elixir:1.10-alpine as build
  2. COPY . .
  3. ENV MIX_ENV=prod
  4. RUN apk add git gcc g++ musl-dev make cmake file-dev &&\
  5. echo "import Config" > config/prod.secret.exs &&\
  6. mix local.hex --force &&\
  7. mix local.rebar --force &&\
  8. mix deps.get --only prod &&\
  9. mkdir release &&\
  10. mix release --path release
  11. FROM alpine
  12. ARG BUILD_DATE
  13. ARG VCS_REF
  14. LABEL maintainer="ops@pleroma.social" \
  15. org.opencontainers.image.title="pleroma" \
  16. org.opencontainers.image.description="Pleroma for Docker" \
  17. org.opencontainers.image.authors="ops@pleroma.social" \
  18. org.opencontainers.image.vendor="pleroma.social" \
  19. org.opencontainers.image.documentation="https://git.pleroma.social/pleroma/pleroma" \
  20. org.opencontainers.image.licenses="AGPL-3.0" \
  21. org.opencontainers.image.url="https://pleroma.social" \
  22. org.opencontainers.image.revision=$VCS_REF \
  23. org.opencontainers.image.created=$BUILD_DATE
  24. ARG HOME=/opt/pleroma
  25. ARG DATA=/var/lib/pleroma
  26. RUN apk update &&\
  27. apk add exiftool ffmpeg imagemagick libmagic ncurses postgresql-client &&\
  28. adduser --system --shell /bin/false --home ${HOME} pleroma &&\
  29. mkdir -p ${DATA}/uploads &&\
  30. mkdir -p ${DATA}/static &&\
  31. chown -R pleroma ${DATA} &&\
  32. mkdir -p /etc/pleroma &&\
  33. chown -R pleroma /etc/pleroma
  34. USER pleroma
  35. COPY --from=build --chown=pleroma:0 /release ${HOME}
  36. COPY ./config/docker.exs /etc/pleroma/config.exs
  37. COPY ./docker-entrypoint.sh ${HOME}
  38. EXPOSE 4000
  39. ENTRYPOINT ["/opt/pleroma/docker-entrypoint.sh"]