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