rebased-podman/Containerfile

71 lines
2.3 KiB
Docker

FROM elixir:1.14.1-alpine as build
ARG MIX_ENV=prod \
OAUTH_CONSUMER_STRATEGIES="twitter facebook google microsoft slack github keycloak:ueberauth_keycloak_strategy"
WORKDIR /src
RUN echo "http://nl.alpinelinux.org/alpine/latest-stable/community" >> /etc/apk/repositories
RUN apk update &&\
apk add git bash gcc g++ musl-dev make cmake file-dev \
exiftool imagemagick libmagic ncurses postgresql-client ffmpeg
RUN git clone https://gitlab.com/soapbox-pub/rebased.git /src
RUN mix local.hex --force &&\
mix local.rebar --force
RUN cd /src &&\
mix deps.get --only prod &&\
mkdir release &&\
mix release --path release
ARG BUILD_DATE
ARG VCS_REF
ENV TZ="Etc/UTC"
LABEL maintainer="hello@soapbox.pub" \
org.opencontainers.image.title="rebased" \
org.opencontainers.image.description="Rebased" \
org.opencontainers.image.authors="hello@soapbox.pub" \
org.opencontainers.image.vendor="soapbox.pub" \
org.opencontainers.image.documentation="https://gitlab.com/soapbox-pub/rebased" \
org.opencontainers.image.licenses="AGPL-3.0" \
org.opencontainers.image.url="https://soapbox.pub" \
org.opencontainers.image.revision=$VCS_REF \
org.opencontainers.image.created=$BUILD_DATE
ARG HOME=/opt/pleroma
ARG DATA=/var/lib/pleroma
RUN apk add curl ca-certificates imagemagick libmagic ffmpeg postgresql-client elixir
RUN git clone https://github.com/facebookresearch/fastText.git ./fasttext &&\
cd fasttext && make && ls
RUN addgroup rebased &&\
adduser --system --shell /bin/false -G rebased --home ${HOME} rebased &&\
mkdir -p ${DATA}/uploads &&\
mkdir -p ${DATA}/static &&\
chown -R rebased ${DATA} &&\
mkdir -p /etc/pleroma &&\
chown -R rebased /etc/pleroma &&\
mkdir -p /usr/share/fasttext &&\
curl -L https://dl.fbaipublicfiles.com/fasttext/supervised-models/lid.176.ftz -o /usr/share/fasttext/lid.176.ftz &&\
chmod 0644 /usr/share/fasttext/lid.176.ftz
RUN cp /src/fasttext/fasttext /usr/bin/fasttext
USER rebased
RUN cp -r /src/release/* ${HOME}
RUN cp /src/config/docker.exs /etc/pleroma/config.exs &&\
cp /src/docker-entrypoint.sh ${HOME}
RUN chown -R rebased ${HOME} ${DATA}
RUN chmod +x ${HOME}/docker-entrypoint.sh
EXPOSE 5000
WORKDIR /var/lib/pleroma
ENTRYPOINT ["/opt/pleroma/docker-entrypoint.sh"]