2020-10-22 15:19:01 +02:00
|
|
|
# First build the application assets
|
2022-10-12 10:22:53 +02:00
|
|
|
FROM node:16 as assets
|
2020-10-22 15:19:01 +02:00
|
|
|
|
2022-10-12 10:22:53 +02:00
|
|
|
RUN apt update && apt dist-upgrade -y && apt install -y python3 build-essential bash imagemagick libncurses5
|
2021-06-16 17:08:49 +02:00
|
|
|
WORKDIR /build
|
2020-10-22 15:19:01 +02:00
|
|
|
COPY js .
|
2021-10-25 16:53:05 +02:00
|
|
|
|
2021-11-09 10:39:04 +01:00
|
|
|
# Network timeout because it's slow when cross-compiling
|
|
|
|
RUN yarn install --network-timeout 100000 \
|
2021-07-22 15:57:31 +02:00
|
|
|
&& yarn run build
|
2020-10-22 15:19:01 +02:00
|
|
|
|
|
|
|
# Then, build the application binary
|
2022-10-12 10:22:53 +02:00
|
|
|
FROM elixir:1.14 AS builder
|
2020-10-22 15:19:01 +02:00
|
|
|
|
2022-10-12 10:22:53 +02:00
|
|
|
RUN apt update && apt dist-upgrade -y && apt install -y build-essential git cmake
|
2020-10-22 15:19:01 +02:00
|
|
|
|
|
|
|
COPY mix.exs mix.lock ./
|
2020-10-19 01:01:59 +02:00
|
|
|
ENV MIX_ENV=prod
|
2020-10-22 15:19:01 +02:00
|
|
|
RUN mix local.hex --force \
|
2020-10-30 15:16:33 +01:00
|
|
|
&& mix local.rebar --force \
|
2022-04-18 14:54:00 +02:00
|
|
|
&& mix deps.get
|
2020-10-19 01:01:59 +02:00
|
|
|
|
2020-10-22 15:19:01 +02:00
|
|
|
COPY lib ./lib
|
|
|
|
COPY priv ./priv
|
2021-03-15 14:57:08 +01:00
|
|
|
COPY config/config.exs config/prod.exs ./config/
|
|
|
|
COPY config/docker.exs ./config/runtime.exs
|
2020-10-31 02:39:32 +01:00
|
|
|
COPY rel ./rel
|
2021-04-22 17:28:03 +02:00
|
|
|
COPY support ./support
|
2021-06-17 10:40:21 +02:00
|
|
|
COPY --from=assets ./priv/static ./priv/static
|
2020-10-22 15:19:01 +02:00
|
|
|
|
2021-11-29 09:56:48 +01:00
|
|
|
RUN mix phx.digest.clean --all \
|
2020-10-30 15:16:33 +01:00
|
|
|
&& mix release
|
2020-10-22 15:19:01 +02:00
|
|
|
|
|
|
|
# Finally setup the app
|
2022-10-12 10:22:53 +02:00
|
|
|
FROM debian:bullseye-slim
|
2020-10-22 15:19:01 +02:00
|
|
|
|
2021-02-01 14:57:58 +01:00
|
|
|
ARG BUILD_DATE
|
|
|
|
ARG VCS_REF
|
|
|
|
|
|
|
|
LABEL org.opencontainers.image.title="mobilizon" \
|
|
|
|
org.opencontainers.image.description="Mobilizon for Docker" \
|
|
|
|
org.opencontainers.image.vendor="joinmobilizon.org" \
|
|
|
|
org.opencontainers.image.documentation="https://docs.joinmobilizon.org" \
|
|
|
|
org.opencontainers.image.licenses="AGPL-3.0" \
|
2021-04-23 19:12:42 +02:00
|
|
|
org.opencontainers.image.source="https://framagit.org/framasoft/mobilizon" \
|
2021-02-01 14:57:58 +01:00
|
|
|
org.opencontainers.image.url="https://joinmobilizon.org" \
|
|
|
|
org.opencontainers.image.revision=$VCS_REF \
|
|
|
|
org.opencontainers.image.created=$BUILD_DATE
|
|
|
|
|
2022-10-12 10:22:53 +02:00
|
|
|
RUN apt update && apt dist-upgrade -y && apt install -y curl openssl ca-certificates libncurses5 file postgresql-client gcc g++ imagemagick python3 python3-pip python3-pillow python3-cffi python3-brotli python3-dev libpango-1.0-0 libxslt-dev fonts-cantarell && rm -rf /var/lib/apt
|
2021-11-08 12:15:02 +01:00
|
|
|
RUN pip install weasyprint pyexcel-ods3
|
2020-10-22 15:19:01 +02:00
|
|
|
|
2021-11-08 20:27:13 +01:00
|
|
|
RUN mkdir -p /var/lib/mobilizon/uploads && chown nobody:nobody /var/lib/mobilizon/uploads
|
2022-01-24 13:01:47 +01:00
|
|
|
RUN mkdir -p /var/lib/mobilizon/uploads/exports/{csv,pdf,ods} && chown -R nobody:nobody /var/lib/mobilizon/uploads/exports
|
2021-11-29 09:56:48 +01:00
|
|
|
RUN mkdir -p /var/lib/mobilizon/timezones
|
|
|
|
RUN curl -L 'https://packages.joinmobilizon.org/tz_world/timezones-geodata.dets' -o /var/lib/mobilizon/timezones/timezones-geodata.dets
|
|
|
|
RUN chown nobody:nobody /var/lib/mobilizon/timezones
|
2021-02-01 14:57:58 +01:00
|
|
|
RUN mkdir -p /etc/mobilizon && chown nobody:nobody /etc/mobilizon
|
2020-11-16 23:28:29 +01:00
|
|
|
|
2020-10-22 15:19:01 +02:00
|
|
|
USER nobody
|
2020-10-19 01:01:59 +02:00
|
|
|
EXPOSE 4000
|
|
|
|
|
2021-02-01 14:57:58 +01:00
|
|
|
ENV MOBILIZON_DOCKER=true
|
|
|
|
|
2020-10-22 15:19:01 +02:00
|
|
|
COPY --from=builder --chown=nobody:nobody _build/prod/rel/mobilizon ./
|
2021-04-23 19:12:52 +02:00
|
|
|
RUN cp /releases/*/runtime.exs /etc/mobilizon/config.exs
|
2020-10-30 15:16:33 +01:00
|
|
|
COPY docker/production/docker-entrypoint.sh ./
|
2020-10-22 15:19:01 +02:00
|
|
|
|
2020-10-30 15:16:33 +01:00
|
|
|
ENTRYPOINT ["./docker-entrypoint.sh"]
|