diff --git a/Dockerfile b/Dockerfile index cfa6b133..20a678c6 100644 --- a/Dockerfile +++ b/Dockerfile @@ -61,6 +61,14 @@ COPY . . COPY --from=vendor /app/vendor ./vendor COPY --from=assets /app/public/build ./public/build +# Symfony's Dotenv::bootEnv() hard-requires a .env file to exist, even in prod. +# The repo's .env is gitignored (it holds dev secrets), so Coolify's clone has +# none and the app fatals with "Unable to read /app/.env". Write a minimal prod +# .env if one wasn't copied in — every real value still comes from the compose +# environment (clear_env=no lets it through), and Dotenv never overwrites an +# already-set env var, so this only satisfies the file-existence requirement. +RUN [ -f .env ] || printf 'APP_ENV=prod\nAPP_DEBUG=0\n' > .env + # Container configuration. COPY docker/php/php.ini /usr/local/etc/php/conf.d/zz-app.ini COPY docker/php/zz-pool.conf /usr/local/etc/php-fpm.d/zz-pool.conf