fix: SQLite database path in container + create on build

Container was using host path for SQLite. Now creates database.sqlite
during Docker build and sets DB_DATABASE=/app/database/database.sqlite
in compose env. Migrations run on startup via laravel-entrypoint.sh.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Claude 2026-04-04 11:36:08 +01:00
parent f60f0803da
commit faa0d89e8d
No known key found for this signature in database
GPG key ID: AF404715446AEB41
2 changed files with 6 additions and 2 deletions

View file

@ -36,12 +36,14 @@ COPY --from=composer:latest /usr/bin/composer /usr/bin/composer
# Copy pre-built application (vendor + node_modules/public built on host)
COPY --chown=www-data:www-data --chmod=755 . .
# Clear stale caches and fix permissions
# Clear stale caches, create SQLite DB, fix permissions
RUN rm -rf bootstrap/cache/*.php \
storage/framework/cache/data/* \
storage/framework/sessions/* \
storage/framework/views/* \
&& chmod -R 777 storage bootstrap/cache
&& mkdir -p database \
&& touch database/database.sqlite \
&& chmod -R 777 storage bootstrap/cache database
# Optimise autoloader + discover packages
RUN composer dump-autoload --optimize \

View file

@ -18,6 +18,8 @@ services:
OCTANE_SERVER: frankenphp
CACHE_STORE: file
SESSION_DRIVER: file
DB_CONNECTION: sqlite
DB_DATABASE: /app/database/database.sqlite
extra_hosts:
- "host.docker.internal:host-gateway"
volumes: