akkoma/Dockerfile

79 lines
1.6 KiB
Text
Raw Normal View History

2023-07-29 15:45:03 +00:00
FROM elixir:1.14-alpine as build
ENV MIX_ENV=prod
ENV ERL_EPMD_ADDRESS=127.0.0.1
2023-07-29 15:45:03 +00:00
ARG BUILD_DIR=/opt/akkoma/
ARG UID=1000
ARG GID=1000
2023-07-29 15:45:03 +00:00
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
2023-07-29 15:45:03 +00:00
WORKDIR ${BUILD_DIR}
2023-08-03 20:24:06 +00:00
RUN mix local.hex --force \
&& mix local.rebar --force
2024-09-05 05:51:35 +00:00
RUN \
--mount=type=cache,target=./deps/,sharing=locked \
--mount=type=bind,source=./mix.exs,target=./mix.exs,readonly \
--mount=type=bind,source=./mix.lock,target=./mix.lock,readonly \
mix deps.get --only ${MIX_ENV}
2023-08-03 20:24:06 +00:00
2023-07-29 15:45:03 +00:00
COPY . .
2024-09-05 05:51:35 +00:00
RUN \
--mount=type=cache,target=./deps/,sharing=locked \
mkdir -p "${BUILD_DIR}_build/" \
2023-07-29 15:45:03 +00:00
&& 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
2023-07-29 15:45:03 +00:00
ARG DATA_DIR=/var/lib/akkoma/
ARG INSTALL_DIR=/opt/akkoma/
ARG CONFIG_DIR=/etc/akkoma/
ARG UID=1000
ARG GID=1000
2023-07-29 15:45:03 +00:00
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
2023-07-29 15:45:03 +00:00
ENV PATH="/opt/akkoma/bin:${PATH}"
2023-08-04 21:09:28 +00:00
ENV AKKOMA_CONFIG_PATH="${CONFIG_DIR}config.exs"
2023-07-29 15:45:03 +00:00
WORKDIR ${INSTALL_DIR}
EXPOSE 4000
2023-07-29 15:45:03 +00:00
ENTRYPOINT [ "docker-entrypoint.sh" ]
2023-07-29 15:45:03 +00:00
CMD [ "pleroma", "start" ]