From 03797a34dbe885678865018eef991d3f3e66d01b Mon Sep 17 00:00:00 2001 From: 3wc <3wc@doesthisthing.work> Date: Mon, 18 Nov 2024 15:59:07 -0500 Subject: [PATCH 1/4] Work towards custom CSS in volume --- abra.sh | 1 + compose.css-volume.yml | 21 +++++++++++++++++++++ entrypoint-css-volume.sh | 5 +++++ 3 files changed, 27 insertions(+) create mode 100644 compose.css-volume.yml create mode 100644 entrypoint-css-volume.sh diff --git a/abra.sh b/abra.sh index d8805ff..a614e3f 100644 --- a/abra.sh +++ b/abra.sh @@ -18,6 +18,7 @@ export HEDGEDOC_CONFIG_VERSION=v1 export MONITORING_CONFIG_VERSION=v2 export DB_ENTRYPOINT_VERSION=v1 export PG_BACKUP_VERSION=v2 +export ENTRYPOINT_CSS_VERSION=v1 customize() { if [ -z "$1" ] diff --git a/compose.css-volume.yml b/compose.css-volume.yml new file mode 100644 index 0000000..b2eaf47 --- /dev/null +++ b/compose.css-volume.yml @@ -0,0 +1,21 @@ +--- +version: "3.8" + +services: + app: + user: root + volumes: + - "custom_css:/css" + entrypoint: /docker-entrypoint.sh + configs: + - source: entrypoint_css + target: /docker-entrypoint.sh + mode: 0555 + +volumes: + custom_css: + +configs: + entrypoint_css: + name: ${STACK_NAME}_entrypoint_css_${ENTRYPOINT_CSS_VERSION} + file: entrypoint-css-volume.sh diff --git a/entrypoint-css-volume.sh b/entrypoint-css-volume.sh new file mode 100644 index 0000000..fa7897b --- /dev/null +++ b/entrypoint-css-volume.sh @@ -0,0 +1,5 @@ +#!/bin/sh + +cp -f /css/custom.css /web/dist/ + +su $(id -un 1000) -s /bin/bash -c 'dumb-init -- ak server' From fc846af1e3dbd6667547f9e9684fa2ad8c804793 Mon Sep 17 00:00:00 2001 From: knoflook Date: Tue, 3 Dec 2024 16:39:32 +0100 Subject: [PATCH 2/4] don't create a new volume --- compose.css-volume.yml | 2 -- entrypoint-css-volume.sh | 2 +- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/compose.css-volume.yml b/compose.css-volume.yml index b2eaf47..ff9307f 100644 --- a/compose.css-volume.yml +++ b/compose.css-volume.yml @@ -4,8 +4,6 @@ version: "3.8" services: app: user: root - volumes: - - "custom_css:/css" entrypoint: /docker-entrypoint.sh configs: - source: entrypoint_css diff --git a/entrypoint-css-volume.sh b/entrypoint-css-volume.sh index fa7897b..cf0afce 100644 --- a/entrypoint-css-volume.sh +++ b/entrypoint-css-volume.sh @@ -1,5 +1,5 @@ #!/bin/sh -cp -f /css/custom.css /web/dist/ +cp -f /web/dist/assets/custom.css /web/dist/custom.css su $(id -un 1000) -s /bin/bash -c 'dumb-init -- ak server' From e2a8f2340f5769857a7797bd0ffd60869388fafa Mon Sep 17 00:00:00 2001 From: knoflook Date: Tue, 3 Dec 2024 17:06:22 +0100 Subject: [PATCH 3/4] update .env.sample and drop unused volume --- .env.sample | 8 +++++--- compose.css-volume.yml | 3 --- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/.env.sample b/.env.sample index 8cfd635..56c1781 100644 --- a/.env.sample +++ b/.env.sample @@ -47,9 +47,11 @@ SECRET_EMAIL_PASS_VERSION=v1 # EMAIL_SUBJECT="Account Recovery" # EMAIL_TOKEN_EXPIRY_MINUTES=30 -COPY_ASSETS="flow_background.jpg|app:/web/dist/assets/images/" -COPY_ASSETS="$COPY_ASSETS icon_left_brand.svg|app:/web/dist/assets/icons/" -COPY_ASSETS="$COPY_ASSETS icon.png|app:/web/dist/assets/icons/" +## custom css and assets +#COMPOSE_FILE="$COMPOSE_FILE:compose.css-volume.yml" +#COPY_ASSETS="flow_background.jpg|app:/web/dist/assets/images/" +#COPY_ASSETS="$COPY_ASSETS icon_left_brand.svg|app:/web/dist/assets/icons/" +#COPY_ASSETS="$COPY_ASSETS icon.png|app:/web/dist/assets/icons/" # Default CSS customisation # COMPOSE_FILE="$COMPOSE_FILE:compose.css.yml" diff --git a/compose.css-volume.yml b/compose.css-volume.yml index ff9307f..5e72a99 100644 --- a/compose.css-volume.yml +++ b/compose.css-volume.yml @@ -10,9 +10,6 @@ services: target: /docker-entrypoint.sh mode: 0555 -volumes: - custom_css: - configs: entrypoint_css: name: ${STACK_NAME}_entrypoint_css_${ENTRYPOINT_CSS_VERSION} From 40e613f861b3d016147bf1f16a22cc8b8e1ce180 Mon Sep 17 00:00:00 2001 From: 3wc <3wc@doesthisthing.work> Date: Tue, 7 Jan 2025 10:15:53 -0500 Subject: [PATCH 4/4] Updates in response to PR feedback --- .env.sample | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/.env.sample b/.env.sample index 56c1781..43ee9a7 100644 --- a/.env.sample +++ b/.env.sample @@ -47,11 +47,14 @@ SECRET_EMAIL_PASS_VERSION=v1 # EMAIL_SUBJECT="Account Recovery" # EMAIL_TOKEN_EXPIRY_MINUTES=30 -## custom css and assets +## assets +COPY_ASSETS="flow_background.jpg|app:/web/dist/assets/images/" +COPY_ASSETS="$COPY_ASSETS icon_left_brand.svg|app:/web/dist/assets/icons/" +COPY_ASSETS="$COPY_ASSETS icon.png|app:/web/dist/assets/icons/" + +# store custom CSS in a css-volume #COMPOSE_FILE="$COMPOSE_FILE:compose.css-volume.yml" -#COPY_ASSETS="flow_background.jpg|app:/web/dist/assets/images/" -#COPY_ASSETS="$COPY_ASSETS icon_left_brand.svg|app:/web/dist/assets/icons/" -#COPY_ASSETS="$COPY_ASSETS icon.png|app:/web/dist/assets/icons/" +# NOTE: this causes the authentik container to run as `root` initially; it uses `su` to drop privileges but technically could introduce a security risk. proceed with caution! # Default CSS customisation # COMPOSE_FILE="$COMPOSE_FILE:compose.css.yml"