2022-07-18 10:17:24 +00:00
|
|
|
FROM hexpm/elixir:1.13.4-erlang-24.3.4.2-alpine-3.16.0 as build
|
2019-07-31 23:35:14 +00:00
|
|
|
|
|
|
|
COPY . .
|
|
|
|
|
2019-08-03 02:28:48 +00:00
|
|
|
ENV MIX_ENV=prod
|
2019-07-31 23:35:14 +00:00
|
|
|
|
2020-11-12 22:20:17 +00:00
|
|
|
RUN apk add git gcc g++ musl-dev make cmake file-dev &&\
|
2022-07-18 10:17:24 +00:00
|
|
|
echo "import Config" > config/prod.secret.exs &&\
|
2019-07-31 23:35:14 +00:00
|
|
|
mix local.hex --force &&\
|
2019-08-03 02:40:31 +00:00
|
|
|
mix local.rebar --force &&\
|
|
|
|
mix deps.get --only prod &&\
|
2019-07-31 23:35:14 +00:00
|
|
|
mkdir release &&\
|
|
|
|
mix release --path release
|
|
|
|
|
2022-07-18 10:17:24 +00:00
|
|
|
FROM alpine:3.16
|
2019-07-31 23:35:14 +00:00
|
|
|
|
2020-01-10 19:09:14 +00:00
|
|
|
ARG BUILD_DATE
|
|
|
|
ARG VCS_REF
|
|
|
|
|
2022-07-18 10:17:24 +00:00
|
|
|
LABEL org.opencontainers.image.title="akkoma" \
|
|
|
|
org.opencontainers.image.description="Akkoma for Docker" \
|
|
|
|
org.opencontainers.image.vendor="akkoma.dev" \
|
|
|
|
org.opencontainers.image.documentation="https://docs.akkoma.dev/stable/" \
|
2020-01-10 19:09:14 +00:00
|
|
|
org.opencontainers.image.licenses="AGPL-3.0" \
|
2022-07-18 10:17:24 +00:00
|
|
|
org.opencontainers.image.url="https://akkoma.dev" \
|
2020-01-10 19:09:14 +00:00
|
|
|
org.opencontainers.image.revision=$VCS_REF \
|
|
|
|
org.opencontainers.image.created=$BUILD_DATE
|
|
|
|
|
2022-07-18 10:17:24 +00:00
|
|
|
ARG HOME=/opt/akkoma
|
|
|
|
ARG DATA=/var/lib/akkoma
|
2019-08-03 02:28:48 +00:00
|
|
|
|
2021-12-17 23:00:29 +00:00
|
|
|
RUN apk update &&\
|
2021-05-30 14:27:58 +00:00
|
|
|
apk add exiftool ffmpeg imagemagick libmagic ncurses postgresql-client &&\
|
2022-07-18 10:17:24 +00:00
|
|
|
adduser --system --shell /bin/false --home ${HOME} akkoma &&\
|
2019-08-03 02:28:48 +00:00
|
|
|
mkdir -p ${DATA}/uploads &&\
|
|
|
|
mkdir -p ${DATA}/static &&\
|
2022-07-18 10:17:24 +00:00
|
|
|
chown -R akkoma ${DATA} &&\
|
|
|
|
mkdir -p /etc/akkoma &&\
|
|
|
|
chown -R akkoma /etc/akkoma
|
2019-07-31 23:35:14 +00:00
|
|
|
|
2022-07-18 10:17:24 +00:00
|
|
|
USER akkoma
|
2019-07-31 23:35:14 +00:00
|
|
|
|
2022-07-18 10:17:24 +00:00
|
|
|
COPY --from=build --chown=akkoma:0 /release ${HOME}
|
2019-08-03 02:28:48 +00:00
|
|
|
|
2022-07-18 10:17:24 +00:00
|
|
|
COPY ./config/docker.exs /etc/akkoma/config.exs
|
2019-08-03 02:28:48 +00:00
|
|
|
COPY ./docker-entrypoint.sh ${HOME}
|
|
|
|
|
|
|
|
EXPOSE 4000
|
|
|
|
|
2022-07-18 10:17:24 +00:00
|
|
|
ENTRYPOINT ["/opt/akkoma/docker-entrypoint.sh"]
|