This commit is contained in:
Mayel de Borniol 2024-04-01 12:19:53 +01:00
parent 1e001cda2f
commit 2c66528aa5
7 changed files with 39 additions and 22 deletions

View file

@ -7,6 +7,7 @@ ARG ELIXIR_DOCKER_IMAGE
#### STEP 1 - Build our app
FROM hexpm/elixir:${ELIXIR_DOCKER_IMAGE} as builder
ARG FLAVOUR
ARG FLAVOUR_PATH
ARG FORKS_TO_COPY_PATH
@ -54,15 +55,15 @@ RUN mix deps.get --only prod
# RUN HEX_HTTP_CONCURRENCY=1 HEX_HTTP_TIMEOUT=120 mix deps.get --only prod
# # ^ useful in case of spotty connectivity
# add extra deps
## add extra deps
# from other flavours
COPY --parents flavours/*/config/* ./
#specified by the core app
# specified by the core app
RUN cp -rfL deps/bonfire/deps.* ./config/
RUN ls -la config/* && ls -la flavours/*/config/*
RUN ls -la config/* && ls flavours/*/config/*
# fetch extras (we need extensions for the non-configurable paths in config/deps_hooks.js)
RUN mix deps.get --only prod
# RUN mix deps.get --only prod
# RUN HEX_HTTP_CONCURRENCY=1 HEX_HTTP_TIMEOUT=120 mix deps.get --only prod
# we need config before compiling Bonfire extensions
@ -77,6 +78,7 @@ COPY ${FORKS_TO_COPY_PATH} ./${FORKS_TO_COPY_PATH}
# Fetch git deps - should be after forks are copied (and updates are fetched, if doing so) in case a forked/updated extension specified any different deps)
RUN mix deps.get --only prod
RUN ls deps/
# Include translations
COPY priv/localisation/ priv/localisation/
@ -121,8 +123,9 @@ RUN MIX_ENV=prod mix deps.clean needle_ulid jason poison --build
# compile app (needs to be before building assets so it includes Surface hooks & component CSS)
RUN MIX_ENV=prod mix compile
# Include any migrations provided by flavour
COPY data/current_flavour/repo priv/repo
# Include any migrations provided by flavour (maybe not needed?)
# COPY data/current_flavour/repo priv/repo
RUN mkdir -p priv/repo/migrations
# Copy DB/repo migrations from installed extensions
RUN mix bonfire.extension.copy_migrations --force --to priv/repo/migrations
@ -178,6 +181,8 @@ WORKDIR /opt/app
# copy app build
COPY --from=builder /opt/app/_build/prod/rel/bonfire /opt/app
COPY --from=builder /opt/app/flavours/ /opt/app/flavours/
RUN ls /opt/app/lib/
# start
CMD ["./bin/bonfire", "start"]

View file

@ -28,7 +28,5 @@ bonfire_open_id = "https://github.com/bonfire-networks/bonfire_open_id#main"
activity_pub = "https://github.com/bonfire-networks/activity_pub#develop"
ex_aws = "https://github.com/bonfire-networks/ex_aws#main"
needle = "https://github.com/bonfire-networks/needle#main"
# surface = "https://github.com/surface-ui/surface"

View file

@ -3,4 +3,4 @@ phoenix = "~> 1.7.0"
phoenix_live_view = "~> 0.20.7"
# API
#absinthe = "~> 1.7.0"
absinthe = "~> 1.7.0"

View file

@ -650,6 +650,7 @@ rel-mix USE_EXT="local" ARGS="":
rel-build-path FORKS_TO_COPY_PATH ARGS="":
@echo "Building $APP_NAME with flavour $FLAVOUR for arch {{arch()}} with image $ELIXIR_DOCKER_IMAGE."
@MIX_ENV=prod docker build {{ ARGS }} --progress=plain \
--build-arg FLAVOUR=$FLAVOUR \
--build-arg FLAVOUR_PATH=data/current_flavour \
--build-arg ALPINE_VERSION=$ALPINE_VERSION \
--build-arg ELIXIR_DOCKER_IMAGE=$ELIXIR_DOCKER_IMAGE \

View file

@ -165,8 +165,7 @@ if not Code.ensure_loaded?(Bonfire.Mixer) do
{dep, _} -> dep in current_flavour_deps
{dep, _, _} -> dep in current_flavour_deps
end)
# |> IO.inspect(label: "other_flavour_deps")
|> IO.inspect(label: "other_flavour_deps")
end
def mess_other_flavour_dep_names(current_flavour \\ System.get_env("FLAVOUR", "classic")) do

34
mix.exs
View file

@ -119,10 +119,28 @@ defmodule Bonfire.Umbrella.MixProject do
{:sobelow, "~> 0.12.1", only: :dev}
]
@deps Mess.deps(Mixer.mess_sources(@flavour), @extra_deps,
use_local_forks?: @use_local_forks,
use_umbrella?: @use_umbrella?,
umbrella_root?: @use_local_forks,
umbrella_path: @umbrella_path
)
@extra_release_apps @deps
|> Enum.filter(fn
{_dep, opts} when is_list(opts) -> opts[:runtime]==false and (is_nil(opts[:only]) or :prod in List.wrap(opts[:only]))
{_dep, _, opts} -> opts[:runtime]==false and (is_nil(opts[:only]) or :prod in List.wrap(opts[:only]))
_ -> false
end)
# Mixer.other_flavour_sources()
|> Mixer.deps_names_list()
|> Enum.map(& {&1, :load})
|> IO.inspect(label: "extensions to include in release")
# TODO: put these in ENV or an external writeable config file similar to deps.*
@config [
# note that the flavour will automatically be added where the dash appears
version: "0.9.10-beta.25",
version: "0.9.10-beta.26",
elixir: ">= #{System.get_env("ELIXIR_VERSION", "1.13.4")}",
flavour: @flavour,
default_flavour: @default_flavour,
@ -214,19 +232,15 @@ defmodule Bonfire.Umbrella.MixProject do
"activity_pub"
]
],
deps:
Mess.deps(Mixer.mess_sources(@flavour), @extra_deps,
use_local_forks?: @use_local_forks,
use_umbrella?: @use_umbrella?,
umbrella_root?: @use_local_forks,
umbrella_path: @umbrella_path
)
deps: @deps,
disabled_extensions: @extra_release_apps
# |> IO.inspect(limit: :infinity)
]
def config, do: @config
def deps, do: config()[:deps]
def project do
[
app: :bonfire_umbrella,
@ -255,9 +269,9 @@ defmodule Bonfire.Umbrella.MixProject do
applications: [
bonfire: :permanent,
# if observability fails it shouldnt take your app down with it
opentelemetry_exporter: :permanent,
opentelemetry_exporter: :temporary,
opentelemetry: :temporary
]
] ++ config()[:disabled_extensions]
]
],
sources_url: "https://github.com/bonfire-networks",

View file

@ -73,7 +73,7 @@
"bonfire_ui_social": {:git, "https://github.com/bonfire-networks/bonfire_ui_social", "2183cb032175fe2bbcf47aa99e89ff9d95b8287e", [branch: "main"]},
"bonfire_ui_social_graph": {:git, "https://github.com/bonfire-networks/bonfire_ui_social_graph", "7a0d51d46a044d266f36a82d6ee2ae432cddeac6", []},
"bonfire_ui_topics": {:git, "https://github.com/bonfire-networks/bonfire_ui_topics", "319d5e6c2cc4eb7b03258b869bb748667cf861e4", [branch: "main"]},
"bonfire_ui_valueflows": {:git, "https://github.com/bonfire-networks/bonfire_ui_valueflows", "a40d6b95c533bc3b726cb20596027606b7f8062b", [branch: "main"]},
"bonfire_ui_valueflows": {:git, "https://github.com/bonfire-networks/bonfire_ui_valueflows", "8452eee928f9d8050d3d6503a6e3ffc0b440d580", [branch: "main"]},
"bonfire_upcycle": {:git, "https://gitlab.com/bonfire-networks/bonfire_upcycle", "31d195cb863bfd289f4f48575b975b470b01c429", [branch: "main"]},
"bonfire_valueflows": {:git, "https://github.com/bonfire-networks/bonfire_valueflows", "a2eebcfbd927d39208b0ce5a0d8015e679823840", [branch: "main"]},
"bonfire_valueflows_api_schema": {:git, "https://github.com/bonfire-networks/bonfire_valueflows_api_schema", "80602121d19691b2d16981afa45c0a01dbc259a3", [branch: "main"]},