Omnibus-style container for Rebased and Soapbox
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

117 lines
4.0 KiB

FROM ubuntu:22.04 as build
ARG MIX_ENV=prod \
OAUTH_CONSUMER_STRATEGIES="twitter facebook google microsoft slack github keycloak:ueberauth_keycloak_strategy"
RUN apt-get update &&\
apt-get install -y git elixir erlang-dev erlang-nox build-essential cmake libssl-dev libmagic-dev automake autoconf libncurses5-dev unzip curl &&\
mix local.hex --force &&\
mix local.rebar --force
RUN git clone /src
RUN cd /src &&\
mix deps.get --only prod &&\
mkdir release &&\
mix release --path release
FROM ubuntu:22.04
ARG DEBIAN_FRONTEND="noninteractive"
ARG HOME=/opt/pleroma
ARG DATA=/var/lib/pleroma
RUN apt-get update &&\
apt-get install -y --no-install-recommends imagemagick libmagic-dev ffmpeg libimage-exiftool-perl libncurses5 postgresql-client curl unzip ca-certificates jq &&\
adduser --system --shell /bin/false --home ${HOME} pleroma &&\
mkdir -p ${DATA}/uploads &&\
mkdir -p ${DATA}/static &&\
curl -L "" -o &&\
mkdir -p release &&\
unzip -d ${DATA} &&\
chown -R pleroma ${DATA} &&\
mkdir -p /etc/pleroma &&\
chown -R pleroma /etc/pleroma
# Caddy
ENV XDG_DATA_HOME /caddy/data
ENV XDG_CONFIG_HOME /caddy/config
RUN apt-get install -y debian-keyring debian-archive-keyring apt-transport-https curl gnupg &&\
curl -1sLf '' | gpg --dearmor -o /usr/share/keyrings/caddy-stable-archive-keyring.gpg &&\
curl -1sLf '' | tee /etc/apt/sources.list.d/caddy-stable.list &&\
apt-get update &&\
apt-get install caddy &&\
adduser --system --shell /bin/false --home /caddy caddy &&\
mkdir /caddy && chown -R caddy:caddy /caddy
# PostgreSQL
RUN apt-get install -y postgresql-14 postgresql-client-14 &&\
mkdir /db &&\
chown -R postgres:postgres /db
# Gosu
RUN set -eux; \
# save list of currently installed packages for later so we can clean up
savedAptMark="$(apt-mark showmanual)"; \
apt-get update; \
apt-get install -y --no-install-recommends ca-certificates wget; \
if ! command -v gpg; then \
apt-get install -y --no-install-recommends gnupg2 dirmngr; \
elif gpg --version | grep -q '^gpg (GnuPG) 1\.'; then \
# "This package provides support for HKPS keyservers." (GnuPG 1.x only)
apt-get install -y --no-install-recommends gnupg-curl; \
fi; \
rm -rf /var/lib/apt/lists/*; \
dpkgArch="$(dpkg --print-architecture | awk -F- '{ print $NF }')"; \
wget -O /usr/local/bin/gosu "$GOSU_VERSION/gosu-$dpkgArch"; \
wget -O /usr/local/bin/gosu.asc "$GOSU_VERSION/gosu-$dpkgArch.asc"; \
# verify the signature
export GNUPGHOME="$(mktemp -d)"; \
gpg --batch --keyserver hkps:// --recv-keys B42F6819007F00F88E364FD4036A9C25BF357DD4; \
gpg --batch --verify /usr/local/bin/gosu.asc /usr/local/bin/gosu; \
command -v gpgconf && gpgconf --kill all || :; \
rm -rf "$GNUPGHOME" /usr/local/bin/gosu.asc; \
# clean up fetch dependencies
apt-mark auto '.*' > /dev/null; \
[ -z "$savedAptMark" ] || apt-mark manual $savedAptMark; \
apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \
chmod +x /usr/local/bin/gosu; \
# verify that the binary works
gosu --version; \
gosu nobody true
USER pleroma
COPY --from=build --chown=pleroma:0 /src/release ${HOME}
COPY ./docker.exs /etc/pleroma/config.exs
USER caddy
COPY ./Caddyfile /etc/Caddyfile
USER root
COPY ./ /run/
RUN chmod 755 /run/
COPY ./ /run/
RUN chmod 755 /run/
VOLUME "/caddy"
VOLUME "/var/lib/postgresql/14/pleroma"
VOLUME "${DATA}/uploads"
ENTRYPOINT ["/run/"]