Dockerfile 1.52 KB
Newer Older
1
FROM elixir:1.9-alpine as build
Ashlynn Anderson's avatar
Ashlynn Anderson committed
2
3
4

COPY . .

5
ENV MIX_ENV=prod
Ashlynn Anderson's avatar
Ashlynn Anderson committed
6

lain's avatar
lain committed
7
RUN apk add git gcc g++ musl-dev make cmake &&\
Ashlynn Anderson's avatar
Ashlynn Anderson committed
8
9
	echo "import Mix.Config" > config/prod.secret.exs &&\
	mix local.hex --force &&\
Ashlynn Anderson's avatar
Ashlynn Anderson committed
10
11
	mix local.rebar --force &&\
	mix deps.get --only prod &&\
Ashlynn Anderson's avatar
Ashlynn Anderson committed
12
13
14
	mkdir release &&\
	mix release --path release

15
FROM alpine:3.11
Ashlynn Anderson's avatar
Ashlynn Anderson committed
16

17
18
19
20
21
22
23
24
25
26
27
28
29
30
ARG BUILD_DATE
ARG VCS_REF

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

31
32
33
ARG HOME=/opt/pleroma
ARG DATA=/var/lib/pleroma

Ashlynn Anderson's avatar
Ashlynn Anderson committed
34
35
RUN echo "http://nl.alpinelinux.org/alpine/latest-stable/community" >> /etc/apk/repositories &&\
	apk update &&\
36
	apk add exiftool imagemagick ncurses postgresql-client &&\
Ashlynn Anderson's avatar
Ashlynn Anderson committed
37
	adduser --system --shell /bin/false --home ${HOME} pleroma &&\
38
39
40
	mkdir -p ${DATA}/uploads &&\
	mkdir -p ${DATA}/static &&\
	chown -R pleroma ${DATA} &&\
Ashlynn Anderson's avatar
Ashlynn Anderson committed
41
42
43
44
45
	mkdir -p /etc/pleroma &&\
	chown -R pleroma /etc/pleroma

USER pleroma

46
47
48
49
50
51
52
53
COPY --from=build --chown=pleroma:0 /release ${HOME}

COPY ./config/docker.exs /etc/pleroma/config.exs
COPY ./docker-entrypoint.sh ${HOME}

EXPOSE 4000

ENTRYPOINT ["/opt/pleroma/docker-entrypoint.sh"]