include source code archive in docker image

This commit is contained in:
Mayel de Borniol 2022-04-07 17:55:20 +12:00
parent 029bcb6f28
commit 9a4aef9341
4 changed files with 16 additions and 9 deletions

View file

@ -82,7 +82,7 @@ jobs:
access_token: ${{ github.token }}
-
name: Pre-build prep
run: mkdir forks/ && mkdir -p data/uploads/ && make rel.config.prepare && touch data/current_flavour/config/deps.path
run: make rel.prepare
-
name: Build and push
id: docker_build
@ -140,7 +140,7 @@ jobs:
# password: ${{ secrets.DOCKERHUB_TOKEN }}
# -
# name: Pre-build prep
# run: mkdir forks/ && mkdir -p data/uploads/ && make rel.config.prepare && touch data/current_flavour/config/deps.path
# run: make rel.prepare
# -
# name: Build and push
# id: docker_build
@ -196,7 +196,7 @@ jobs:
password: ${{ secrets.DOCKERHUB_TOKEN }}
-
name: Pre-build prep
run: mkdir forks/ && mkdir -p data/uploads/ && make rel.config.prepare && touch data/current_flavour/config/deps.path
run: make rel.prepare
-
name: Build and push
id: docker_build
@ -253,7 +253,7 @@ jobs:
password: ${{ secrets.DOCKERHUB_TOKEN }}
-
name: Pre-build prep
run: mkdir forks/ && mkdir -p data/uploads/ && make rel.config.prepare && touch data/current_flavour/config/deps.path
run: make rel.prepare
-
name: Build and push
id: docker_build

View file

@ -27,7 +27,7 @@ ENV HOME=/opt/app/ TERM=xterm MIX_ENV=prod APP_NAME=$APP_NAME FLAVOUR=$FLAVOUR F
WORKDIR $HOME
# necessary utils
RUN apk add --no-cache curl git rust cargo npm bash
RUN apk add --no-cache tar curl git rust cargo npm bash
# dependencies for comeonin
RUN apk add --no-cache make gcc libc-dev
@ -61,7 +61,7 @@ RUN rm ./config/deps.path
# Update Bonfire extensions to latest git version
RUN mix do bonfire.deps.update
# Uncomment these lines only if you want to include locally-forked deps in the release
# Uncomment these lines only if you want to include locally-forked deps in the release (rather than only ones downloaded from hex.pm or git)
# COPY data/current_flavour/config/deps.path ./config
# COPY forks/ ./
# RUN mix do deps.get --only prod
@ -96,6 +96,9 @@ COPY data/current_flavour/config/deps_hooks.js data/current_flavour/config/deps_
RUN mix assets.release
RUN MIX_ENV=prod CI=1 mix phx.digest
COPY LICENSE ./
RUN mkdir -p priv/data/uploads && tar --exclude=*.env -czvf priv/data/uploads/source.tar.gz lib deps assets mix.exs mix.lock mess.exs LICENSE data/current_flavour/
# build final OTP release
RUN MIX_ENV=prod CI=1 mix release

View file

@ -349,9 +349,13 @@ rel.env:
$(eval export)
rel.config.prepare: rel.env # copy current flavour's config, without using symlinks
rm -rf ./data/current_flavour
@cp -rfL $(FLAVOUR_PATH) ./data/current_flavour
rel.rebuild: rel.env init rel.config.prepare assets.prepare ## Build the Docker image
rel.prepare: rel.env rel.config.prepare # copy current flavour's config, without using symlinks
@mkdir -p forks/ && mkdir -p data/uploads/ && touch data/current_flavour/config/deps.path
rel.rebuild: rel.env init rel.prepare assets.prepare ## Build the Docker image
docker build \
--no-cache \
--build-arg FLAVOUR_PATH=data/current_flavour \
@ -362,7 +366,7 @@ rel.rebuild: rel.env init rel.config.prepare assets.prepare ## Build the Docker
-f $(APP_REL_DOCKERFILE) .
@echo Build complete: $(APP_DOCKER_REPO):$(APP_VSN)-release-$(APP_BUILD)
rel.build: rel.env init rel.config.prepare assets.prepare ## Build the Docker image using previous cache
rel.build: rel.env init rel.prepare assets.prepare ## Build the Docker image using previous cache
@echo "Building $(APP_NAME) with flavour $(FLAVOUR)"
docker build \
--build-arg FLAVOUR_PATH=data/current_flavour \

View file

@ -3,7 +3,7 @@ defmodule Bonfire.MixProject do
use Mix.Project
@config [ # TODO: put these in ENV or an external writeable config file similar to deps.*
version: "0.2.0-alpha.18", # note that the flavour will automatically be added where the dash appears
version: "0.2.0-alpha.19", # note that the flavour will automatically be added where the dash appears
elixir: "~> 1.12",
default_flavour: "classic",
logo: "assets/static/images/bonfire-icon.png",