Files
ADconsle/docker/php/entrypoint.sh
T
kzbkowskiandClaude Sonnet 5 b313c126ce
CI / PHP 8.2 (push) Failing after 1m40s
CI / PHP 8.3 (push) Failing after 55s
CI / PHP 8.4 (push) Failing after 1m11s
Release image / image (push) Successful in 2m33s
ADconsole v1.1.0
Config backup, a Docker dev/prod split, and a Gitea-built release image.

Added
- /settings -> General -> "Configuration backup": JSON export/import of the
  panel's general settings + attribute definitions
  (App\Services\ConfigBackupService); audited as config.export / config.import.
  Export can leave out the attribute-encryption key. No AD data included.
- docker/compose.dev.yaml: live-reload dev stack that bind-mounts the working
  tree. docker/php/Dockerfile is now multi-stage (base -> dev / prod).
- .github/workflows/release.yml: on every vX.Y.Z tag, builds the prod image and
  pushes gitea.kzbikowski.pl/kzbkowski/adconsole:{X.Y.Z,X.Y,latest}.

Changed
- docker/compose.yaml: self-contained prod image (app code + composer install
  --no-dev baked in via COPY); persistent state in docker/data/{app_storage,db};
  defaults to the released image (ADCONSOLE_VERSION pins a tag, ADCONSOLE_IMAGE
  replaces the ref). Apache now honours public/.htaccess (AllowOverride All).
  Run from the repo root with --env-file .env.
- Repo root now holds only README.md; CHANGELOG / CONTRIBUTING / SECURITY /
  CODE_OF_CONDUCT moved under docs/.

Upgrade notes: docs/upgrading.md#v110--docker-layout. Full log: docs/CHANGELOG.md.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JKT9p3bfP8RZesExdYCS52
2026-09-10 09:13:04 +02:00

58 lines
1.9 KiB
Bash

#!/bin/sh
# First-run / every-boot bootstrap for the ADconsole container. Every step is
# idempotent, so it is safe to run on each start.
#
# dev (ADCONSOLE_ENV=dev): the repo is bind-mounted. Install deps (incl.
# dev), generate APP_KEY, clear caches only — no
# config cache, so .env edits take effect on reload.
# prod (default): code + vendor are baked into the image. Just fix
# storage ownership, migrate and warm the caches.
set -e
cd /var/www/html
if [ ! -f .env ]; then
echo "[adconsole] .env is missing — mount your filled-in .env at /var/www/html/.env" >&2
echo " (cp .env.example .env, edit it, then start the stack again)" >&2
exit 1
fi
# 1. PHP dependencies — only when absent (fresh clone in dev; never in prod).
if [ ! -f vendor/autoload.php ]; then
echo "[adconsole] installing composer dependencies..."
if [ "$ADCONSOLE_ENV" = "dev" ]; then
composer install --no-interaction --prefer-dist
else
composer install --no-dev --no-interaction --prefer-dist --optimize-autoloader
fi
fi
# 2. Application key.
if ! grep -qE '^APP_KEY=.+' .env; then
echo "[adconsole] generating APP_KEY..."
php artisan key:generate --force
fi
# 3. Writable storage tree — the bind mount / volume can start empty.
mkdir -p \
storage/framework/cache/data \
storage/framework/sessions \
storage/framework/views \
storage/logs \
storage/app/public \
storage/app/private \
bootstrap/cache
chown -R www-data:www-data storage bootstrap/cache 2>/dev/null || true
# 4. Database schema + storage symlink.
php artisan migrate --force
php artisan storage:link 2>/dev/null || true
# 5. Framework caches.
php artisan optimize:clear
if [ "$ADCONSOLE_ENV" != "dev" ]; then
php artisan optimize
fi
exec "$@"