2022-07-27 22:48:13 +01:00
|
|
|
FROM elixir:1.13.4-alpine as build
|
2019-08-01 00:35:14 +01:00
|
|
|
|
|
|
|
COPY . .
|
|
|
|
|
2019-08-03 03:28:48 +01:00
|
|
|
ENV MIX_ENV=prod
|
2019-08-01 00:35:14 +01:00
|
|
|
|
2020-11-12 22:20:17 +00:00
|
|
|
RUN apk add git gcc g++ musl-dev make cmake file-dev &&\
|
2022-07-18 11:17:24 +01:00
|
|
|
echo "import Config" > config/prod.secret.exs &&\
|
2019-08-01 00:35:14 +01:00
|
|
|
mix local.hex --force &&\
|
2019-08-03 03:40:31 +01:00
|
|
|
mix local.rebar --force &&\
|
|
|
|
mix deps.get --only prod &&\
|
2019-08-01 00:35:14 +01:00
|
|
|
mkdir release &&\
|
|
|
|
mix release --path release
|
|
|
|
|
2022-07-18 11:17:24 +01:00
|
|
|
FROM alpine:3.16
|
2019-08-01 00:35:14 +01:00
|
|
|
|
2020-01-10 19:09:14 +00:00
|
|
|
ARG BUILD_DATE
|
|
|
|
ARG VCS_REF
|
|
|
|
|
2022-07-18 11:17:24 +01: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 11:17:24 +01: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 11:17:24 +01:00
|
|
|
ARG HOME=/opt/akkoma
|
|
|
|
ARG DATA=/var/lib/akkoma
|
2019-08-03 03:28:48 +01:00
|
|
|
|
2021-12-17 23:00:29 +00:00
|
|
|
RUN apk update &&\
|
2021-05-30 15:27:58 +01:00
|
|
|
apk add exiftool ffmpeg imagemagick libmagic ncurses postgresql-client &&\
|
2022-07-18 11:17:24 +01:00
|
|
|
adduser --system --shell /bin/false --home ${HOME} akkoma &&\
|
2019-08-03 03:28:48 +01:00
|
|
|
mkdir -p ${DATA}/uploads &&\
|
|
|
|
mkdir -p ${DATA}/static &&\
|
2022-07-18 11:17:24 +01:00
|
|
|
chown -R akkoma ${DATA} &&\
|
|
|
|
mkdir -p /etc/akkoma &&\
|
|
|
|
chown -R akkoma /etc/akkoma
|
2019-08-01 00:35:14 +01:00
|
|
|
|
2022-07-18 11:17:24 +01:00
|
|
|
USER akkoma
|
2019-08-01 00:35:14 +01:00
|
|
|
|
2022-07-18 11:17:24 +01:00
|
|
|
COPY --from=build --chown=akkoma:0 /release ${HOME}
|
2019-08-03 03:28:48 +01:00
|
|
|
|
2022-07-18 11:17:24 +01:00
|
|
|
COPY ./config/docker.exs /etc/akkoma/config.exs
|
2019-08-03 03:28:48 +01:00
|
|
|
COPY ./docker-entrypoint.sh ${HOME}
|
|
|
|
|
|
|
|
EXPOSE 4000
|
|
|
|
|
2022-07-18 11:17:24 +01:00
|
|
|
ENTRYPOINT ["/opt/akkoma/docker-entrypoint.sh"]
|