2020-10-22 13:19:01 +00:00
|
|
|
# First build the application assets
|
2021-05-19 08:29:45 +00:00
|
|
|
FROM node:16-alpine as assets
|
2020-10-22 13:19:01 +00:00
|
|
|
|
2021-05-19 12:39:19 +00:00
|
|
|
RUN apk add --no-cache python3 build-base libwebp-tools bash imagemagick ncurses
|
2020-10-22 13:19:01 +00:00
|
|
|
|
|
|
|
COPY js .
|
|
|
|
RUN yarn install \
|
2020-10-30 14:16:33 +00:00
|
|
|
&& yarn run build
|
2020-10-22 13:19:01 +00:00
|
|
|
|
|
|
|
# Then, build the application binary
|
2021-02-04 17:58:15 +00:00
|
|
|
FROM elixir:1.11-alpine AS builder
|
2020-10-22 13:19:01 +00:00
|
|
|
|
|
|
|
RUN apk add --no-cache build-base git cmake
|
|
|
|
|
|
|
|
COPY mix.exs mix.lock ./
|
2020-10-18 23:01:59 +00:00
|
|
|
ENV MIX_ENV=prod
|
2020-10-22 13:19:01 +00:00
|
|
|
RUN mix local.hex --force \
|
2020-10-30 14:16:33 +00:00
|
|
|
&& mix local.rebar --force \
|
|
|
|
&& mix deps.get
|
2020-10-18 23:01:59 +00:00
|
|
|
|
2020-10-22 13:19:01 +00:00
|
|
|
COPY lib ./lib
|
|
|
|
COPY priv ./priv
|
2021-03-15 13:57:08 +00:00
|
|
|
COPY config/config.exs config/prod.exs ./config/
|
|
|
|
COPY config/docker.exs ./config/runtime.exs
|
2020-10-31 01:39:32 +00:00
|
|
|
COPY rel ./rel
|
2021-04-22 15:28:03 +00:00
|
|
|
COPY support ./support
|
2020-10-22 13:19:01 +00:00
|
|
|
COPY --from=assets ./priv/static ./priv/static
|
|
|
|
|
|
|
|
RUN mix phx.digest \
|
2020-10-30 14:16:33 +00:00
|
|
|
&& mix release
|
2020-10-22 13:19:01 +00:00
|
|
|
|
|
|
|
# Finally setup the app
|
|
|
|
FROM alpine
|
|
|
|
|
2021-02-01 13:57:58 +00: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 17:12:42 +00:00
|
|
|
org.opencontainers.image.source="https://framagit.org/framasoft/mobilizon" \
|
2021-02-01 13:57:58 +00:00
|
|
|
org.opencontainers.image.url="https://joinmobilizon.org" \
|
|
|
|
org.opencontainers.image.revision=$VCS_REF \
|
|
|
|
org.opencontainers.image.created=$BUILD_DATE
|
|
|
|
|
2020-11-14 18:31:23 +00:00
|
|
|
RUN apk add --no-cache openssl ncurses-libs file postgresql-client
|
2020-10-22 13:19:01 +00:00
|
|
|
|
2020-11-16 22:28:29 +00:00
|
|
|
RUN mkdir -p /app/uploads && chown nobody:nobody /app/uploads
|
2021-02-01 13:57:58 +00:00
|
|
|
RUN mkdir -p /etc/mobilizon && chown nobody:nobody /etc/mobilizon
|
2020-11-16 22:28:29 +00:00
|
|
|
|
2020-10-22 13:19:01 +00:00
|
|
|
USER nobody
|
2020-10-18 23:01:59 +00:00
|
|
|
EXPOSE 4000
|
|
|
|
|
2021-02-01 13:57:58 +00:00
|
|
|
ENV MOBILIZON_DOCKER=true
|
|
|
|
|
2020-10-22 13:19:01 +00:00
|
|
|
COPY --from=builder --chown=nobody:nobody _build/prod/rel/mobilizon ./
|
2021-04-23 17:12:52 +00:00
|
|
|
RUN cp /releases/*/runtime.exs /etc/mobilizon/config.exs
|
2020-10-30 14:16:33 +00:00
|
|
|
COPY docker/production/docker-entrypoint.sh ./
|
2020-10-22 13:19:01 +00:00
|
|
|
|
2020-10-30 14:16:33 +00:00
|
|
|
ENTRYPOINT ["./docker-entrypoint.sh"]
|