diff --git a/README.md b/README.md index b8b2748..07c90e9 100644 --- a/README.md +++ b/README.md @@ -87,5 +87,8 @@ This is how to configure your Mattermost server to accept logins from your Authe - `abra app deploy YOURAPPNAME` +# Technical Notes +This recipe inserts a statically-compiled busybox binary from `busybox:1.25-uclibc` into the distroless container, to allow running the custom entrypoint shell script which configures Mattermost. + [`abra`]: https://git.coopcloud.tech/coop-cloud/abra [`coop-cloud/traefik`]: https://git.coopcloud.tech/coop-cloud/traefik diff --git a/abra.sh b/abra.sh index fb0d7b2..f140353 100644 --- a/abra.sh +++ b/abra.sh @@ -1,5 +1,6 @@ -export ENTRYPOINT_VERSION=v2 +export ENTRYPOINT_VERSION=v3 export MATTERMOST_CONFIG_VERSION=v1 +export SHELL_VERSION=v1 reset_config() { cp /config-to-copy.json /mattermost/config/config.json && touch /mattermost/config/CoopCloudManaged diff --git a/bin/busybox b/bin/busybox new file mode 100755 index 0000000..f944901 Binary files /dev/null and b/bin/busybox differ diff --git a/compose.yml b/compose.yml index d25ddb8..5d59974 100644 --- a/compose.yml +++ b/compose.yml @@ -2,7 +2,7 @@ version: "3.8" services: app: - image: mattermost/mattermost-team-edition:10.5.14 + image: mattermost/mattermost-team-edition:10.11 environment: - TZ - MM_SQLSETTINGS_DRIVERNAME=postgres @@ -33,6 +33,9 @@ services: - "backupbot.backup=true" - "backupbot.backup.path=/mattermost,/etc/ssl" configs: + - source: busybox + target: /bin/busybox + mode: 0555 - source: abra_mattermost_entrypoint target: /abra-mattermost-entrypoint.sh mode: 0555 @@ -69,6 +72,9 @@ configs: abra_mattermost_entrypoint: name: ${STACK_NAME}_entrypoint_${ENTRYPOINT_VERSION} file: ./entrypoint.sh + busybox: + name: ${STACK_NAME}_busybox_${SHELL_VERSION} + file: ./bin/busybox networks: diff --git a/entrypoint.sh b/entrypoint.sh index a2d385a..a42aa0d 100644 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -1,4 +1,13 @@ -#!/bin/sh +#!/bin/busybox sh +/bin/busybox mkdir /tmp/bin +export PATH=$PATH:/tmp/bin +/bin/busybox ln -s /bin/busybox /tmp/bin/ln +ln -s /bin/busybox /tmp/bin/cat +ln -s /bin/busybox /tmp/bin/echo +ln -s /bin/busybox /tmp/bin/cp +ln -s /bin/busybox /tmp/bin/touch +ln -s /bin/busybox /tmp/bin/rm + set -e if test -f "/run/secrets/postgres_password"; then pwd=`cat /run/secrets/postgres_password` @@ -21,5 +30,7 @@ if ! test -f "/mattermost/config/CoopCloudManaged"; then cp /config-to-copy.json /mattermost/config/config.json && touch /mattermost/config/CoopCloudManaged fi -# https://github.com/mattermost/mattermost-server/blob/master/build/Dockerfile -/entrypoint.sh "mattermost" \ No newline at end of file +rm -rf /tmp/bin + +# https://github.com/mattermost/mattermost/blob/master/server/build/Dockerfile +/mattermost/bin/mattermost \ No newline at end of file