2024-04-10 14:36:21 +02:00
|
|
|
ARG IMAGE="elixir:1.16"
|
2023-11-20 18:37:35 +01:00
|
|
|
|
|
|
|
FROM ${IMAGE} as build
|
2021-10-21 12:00:38 +02:00
|
|
|
SHELL ["/bin/bash", "-c"]
|
|
|
|
ENV MIX_ENV prod
|
|
|
|
# ENV LANG en_US.UTF-8
|
|
|
|
ARG APP_ASSET
|
|
|
|
|
2023-08-18 16:22:19 +02:00
|
|
|
# Fix qemu segfault on arm64
|
|
|
|
# See https://github.com/plausible/analytics/pull/2879 and https://github.com/erlang/otp/pull/6340
|
|
|
|
ARG ERL_FLAGS=""
|
|
|
|
ENV ERL_FLAGS=$ERL_FLAGS
|
|
|
|
|
2021-10-21 12:00:38 +02:00
|
|
|
# Set the right versions
|
|
|
|
ENV ELIXIR_VERSION latest
|
|
|
|
ENV ERLANG_VERSION latest
|
2023-11-20 18:37:35 +01:00
|
|
|
ENV NODE_VERSION 20
|
2021-10-21 12:00:38 +02:00
|
|
|
|
|
|
|
# Install system dependencies
|
|
|
|
RUN apt-get update -yq && apt-get install -yq build-essential cmake postgresql-client git curl gnupg unzip exiftool webp imagemagick gifsicle
|
|
|
|
RUN apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
|
|
|
|
|
2023-11-14 17:24:42 +01:00
|
|
|
# # Install Node
|
2021-10-21 12:00:38 +02:00
|
|
|
# RUN curl -sL https://deb.nodesource.com/setup_16.x | bash && apt-get install nodejs -yq
|
|
|
|
|
|
|
|
# Install build tools
|
|
|
|
RUN source /root/.bashrc && \
|
|
|
|
mix local.rebar --force && \
|
|
|
|
mix local.hex -if-missing --force
|
|
|
|
|
|
|
|
RUN mkdir /mobilizon
|
|
|
|
COPY ./ /mobilizon
|
|
|
|
WORKDIR /mobilizon
|
|
|
|
|
|
|
|
# # Build front-end
|
2023-11-14 17:24:42 +01:00
|
|
|
# RUN npm install
|
|
|
|
# RUN npm run build
|
2021-10-21 12:00:38 +02:00
|
|
|
|
|
|
|
# Elixir release
|
|
|
|
RUN source /root/.bashrc && \
|
2022-04-18 14:54:00 +02:00
|
|
|
mix deps.get --only prod && \
|
2021-10-21 12:00:38 +02:00
|
|
|
mix compile && \
|
|
|
|
mix phx.digest.clean --all && \
|
2022-10-17 08:37:22 +02:00
|
|
|
mix phx.digest && \
|
2021-10-21 12:00:38 +02:00
|
|
|
mix release --path release/mobilizon && \
|
|
|
|
cd release/mobilizon && \
|
|
|
|
ln -s lib/mobilizon-*/priv priv && \
|
|
|
|
cd ../../
|
|
|
|
|
|
|
|
# Make a release archive
|
|
|
|
RUN tar -zcf /mobilizon/${APP_ASSET} -C release mobilizon
|