This commit is contained in:
Mayel de Borniol 2022-12-09 17:07:07 +13:00
parent 4dacd82b79
commit 1638de2940
6 changed files with 22 additions and 20 deletions

View file

@ -38,6 +38,7 @@ forks/*/.mix
forks/*/.hex
forks/*/_build
forks/*/deps
forks/*/assets/node_modules
extensions/*/data/postgres
extensions/*/.git
extensions/*/.config
@ -46,3 +47,4 @@ extensions/*/.mix
extensions/*/.hex
extensions/*/_build
extensions/*/deps
extensions/*/assets/node_modules

View file

@ -27,15 +27,12 @@ ARG FLAVOUR_PATH
#### STEP 1 - Build our app
FROM elixir:${ELIXIR_IMAGE} as builder
# necessary utils + dependencies for comeonin
RUN apk --update add tar curl git rust cargo npm yarn bash make gcc libc-dev
ENV HOME=/opt/app/ TERM=xterm MIX_ENV=prod APP_NAME=$APP_NAME FLAVOUR=$FLAVOUR FLAVOUR_PATH=./
WORKDIR $HOME
# necessary utils
RUN apk add tar curl git rust cargo npm yarn bash
# dependencies for comeonin
RUN apk add make gcc libc-dev
# Cache elixir deps
COPY mix.exs mix.lock ./
COPY lib/mix ./lib/mix
@ -75,18 +72,20 @@ RUN mix do deps.get --only prod
COPY priv/localisation/ priv/localisation/
# RUN ls -la priv/localisation/
COPY docs/*.md ./docs/
# Compile remaining deps
RUN MIX_ENV=prod mix do deps.compile
# JS package manager
# RUN npm install -g pnpm
# install JS deps
COPY assets/package.json assets/*.sh ./assets/
COPY js-deps-get.sh ./
# COPY assets/package.json ./assets/
# COPY assets/pnpm-lock.yaml ./assets/
COPY assets/yarn.lock ./assets/
RUN chmod +x assets/*.sh
# COPY assets/yarn.lock ./assets/
RUN chmod +x config/*.sh
RUN sh assets/install_app.sh
RUN chmod +x ./*.sh
RUN sh config/deps.js.sh
# FIXME: should we be installing dev deps here?
@ -98,28 +97,28 @@ COPY data/current_flavour/repo priv/repo
# bonfire-app code & assets
COPY lib lib
COPY assets assets
# COPY assets assets
# RUN ls -la assets/static
# include an archive of the source code
COPY LICENSE ./
COPY docs/*.md ./docs/
RUN mkdir -p apps/
RUN mkdir -p extensions/
RUN mkdir -p forks/
RUN mkdir -p priv/static/
# COPY priv/extras/ priv/extras/
RUN tar --exclude=*.env --exclude=.git --exclude=node_modules --exclude=assets/static/data -czvf priv/static/source.tar.gz lib deps apps extensions forks assets config docs priv/repo mix.exs mix.lock LICENSE
RUN tar --exclude=*.env --exclude=.git --exclude=node_modules --exclude=*/*/assets/static/data -czvf priv/static/source.tar.gz lib deps apps extensions forks config docs priv/repo mix.exs mix.lock LICENSE
# prepare static assets
COPY data/current_flavour/config/deps_hooks.js data/current_flavour/config/deps_hooks.js
RUN cd ./assets && yarn build && cd ..
RUN cd ./deps/bonfire_ui_common/assets && yarn && yarn build
RUN MIX_ENV=prod CI=1 mix phx.digest
# RUN ls -la priv/static
# build final OTP release
RUN MIX_ENV=prod CI=1 mix release
##### STEP 2 - Prepare the server image
##### STEP 2 - Prepare the server image ####
# From this line onwards, we're in a new image, which will be the image used in production
FROM alpine:${ALPINE_VERSION}

View file

@ -13,7 +13,8 @@ import { ThemeHooks } from "./../../../deps/bonfire_ui_common/assets/js/theme"
import { FeedHooks } from "./../../../deps/bonfire_ui_common/assets/js/feed"
import { ImageHooks } from "./../../../deps/bonfire_ui_common/assets/js/image"
import { EmojiHooks } from "./../../../deps/bonfire_ui_common/assets/js/emoji"
import { EditorCkHooks } from "./../../../deps/bonfire_editor_ck/assets/js/extension"
// import { EditorCkHooks } from "./../../../deps/bonfire_editor_ck/assets/js/extension"
// import { EditorQuillHooks } from "./../../../deps/bonfire_editor_quill/assets/js/extension"
import { ComposerHooks } from "./../../../deps/bonfire_ui_common/assets/js/composer"
// import { EditorQuillHooks } from "./../../../deps/bonfire_editor_quill/assets/js/extension"
@ -23,6 +24,6 @@ import { ComposerHooks } from "./../../../deps/bonfire_ui_common/assets/js/compo
// import { EncryptHooks } from "./../../../deps/bonfire_encrypt/assets/js/extension"
Object.assign(ExtensionHooks, ComposerHooks, EmojiHooks, ResponsiveTabsHooks, EditorCkHooks, CarouselHooks, FeedHooks, ChangeLocaleHooks, InputSelectHooks, NotificationsHooks, ThemeHooks, ImageHooks) // EditorCkHooks
Object.assign(ExtensionHooks, ComposerHooks, EmojiHooks, ResponsiveTabsHooks, CarouselHooks, FeedHooks, ChangeLocaleHooks, InputSelectHooks, NotificationsHooks, ThemeHooks, ImageHooks) // EditorCkHooks
export { ExtensionHooks }

View file

@ -140,7 +140,7 @@ config :bonfire, Bonfire.Web.Endpoint,
http: [
port: server_port,
transport_options:
if(System.get_env("PLUG_SERVER") != "bandit", do: [socket_opts: [:inet6]], else: [])
if(System.get_env("PLUG_SERVER") != "bandit", do: [socket_opts: [:inet6]], else: [:inet6])
],
adapter:
if(System.get_env("PLUG_SERVER") != "bandit",

View file

@ -483,7 +483,7 @@ rel-rebuild: rel-init rel-prepare assets-prepare
# Build the Docker image (NOT including changes to local forks)
rel-build-release: rel-init rel-prepare assets-prepare
@echo "Please note that the build will not include any changes in forks that haven't been committed and pushed, you may want to run just contrib-release first."
@just rel-build "data/null" --no-cache
@just rel-build "data/null"
# Build the Docker image (including changes to local forks, and using caching)
rel-build FORKS_TO_COPY_PATH="" ARGS="":

View file

@ -196,7 +196,7 @@ defmodule Bonfire.Umbrella.MixProject do
# to enable debugging
strip_beams: false,
applications: [
my_app: :permanent,
bonfire: :permanent,
# if observability fails it shouldnt take your app down with it
opentelemetry_exporter: :permanent,
opentelemetry: :temporary