From 1681e3d92653ee3514cb02ecc4b8398c5f0cbd15 Mon Sep 17 00:00:00 2001 From: Ruben Momoa Date: Thu, 22 Aug 2024 16:41:22 +0200 Subject: [PATCH] install extra packages and extensions on first boot --- build/start-container.sh | 11 +++++++++++ docker-compose.yml | 2 ++ 2 files changed, 13 insertions(+) diff --git a/build/start-container.sh b/build/start-container.sh index e7abf6d..7f22fc0 100644 --- a/build/start-container.sh +++ b/build/start-container.sh @@ -3,6 +3,17 @@ # exit when any command fails set -e +# install extra packages and extensions on first boot +if [[ ! -f /etc/first_boot ]]; then + if [[ -n "${EXTRA_APK_PACKAGES// /}" ]]; then + apk add --no-cache "$EXTRA_APK_PACKAGES" + fi + if [[ -n "${EXTRA_PHP_EXTENSIONS// /}" ]]; then + docker-php-ext-install "$EXTRA_PHP_EXTENSIONS" + fi + touch /etc/first_boot +fi + if [[ "$BOOT_NPM_INSTALL" = true ]]; then echo "npm install" npm install diff --git a/docker-compose.yml b/docker-compose.yml index ce008c0..438ba01 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -16,6 +16,8 @@ services: BOOT_NPM_DEV: true # also starts `npm dev` BOOT_NPM_INSTALL: true # runs `npm install` on boot BOOT_COMPOSER_INSTALL: true # runs `composer install` on boot + #EXTRA_APK_PACKAGES: # string with extra packages to install on first boot example: "git python" + #EXTRA_PHP_EXTENSIONS: # string with extra php extensions to install on first boot depends_on: - mysql - redis