FROM elixir:1.14-alpine as build ENV MIX_ENV=prod ENV ERL_EPMD_ADDRESS=127.0.0.1 ARG BUILD_DIR=/opt/akkoma/ ARG UID=1000 ARG GID=1000 RUN addgroup -g ${GID} akkoma \ && adduser -u ${UID} -G akkoma -s /bin/sh -D akkoma \ && apk add --no-cache \ git \ gcc \ g++ \ musl-dev \ make \ cmake \ file-dev WORKDIR ${BUILD_DIR} RUN mix local.hex --force \ && mix local.rebar --force COPY ./mix.exs ./mix.lock ./ RUN mix deps.get --only ${MIX_ENV} COPY . . RUN mkdir -p "${BUILD_DIR}_build/" \ && mix release --path "${BUILD_DIR}_build" FROM elixir:1.14-alpine as web ENV MIX_ENV=prod ENV ERL_EPMD_ADDRESS=127.0.0.1 ARG DATA_DIR=/var/lib/akkoma/ ARG INSTALL_DIR=/opt/akkoma/ ARG CONFIG_DIR=/etc/akkoma/ ARG UID=1000 ARG GID=1000 RUN addgroup -g ${GID} akkoma \ && adduser -u ${UID} -G akkoma -s /bin/sh -D akkoma \ && apk add --no-cache \ exiftool \ ffmpeg \ imagemagick \ libmagic \ ncurses \ postgresql-client RUN mkdir -p "${DATA_DIR}uploads/" \ && mkdir -p "${DATA_DIR}static/" \ && mkdir -p "${INSTALL_DIR}" \ && mkdir -p "${CONFIG_DIR}" COPY --from=build ${INSTALL_DIR}_build/ ${INSTALL_DIR} COPY ./docker-entrypoint.sh /usr/local/bin/docker-entrypoint.sh ENV PATH="/opt/akkoma/bin:${PATH}" ENV AKKOMA_CONFIG_PATH="${CONFIG_DIR}config.exs" WORKDIR ${INSTALL_DIR} EXPOSE 4000 ENTRYPOINT [ "docker-entrypoint.sh" ] CMD [ "pleroma", "start" ]