Skip to content

Fix: Add missing composer install, .env setup, and Laravel artisan bootstrap to Docker entrypoint #272

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

fuadadhim24
Copy link

@fuadadhim24 fuadadhim24 commented Jul 28, 2025

What’s Fixed

This PR addresses two issues encountered during Docker container startup in a Laravel project:

  1. Missing vendor autoload error:
    Laravel fails with Failed opening required 'vendor/autoload.php' if composer install hasn't run.

    • Fix: Automatically run composer install if /var/www/vendor does not exist.
  2. Missing .env file and uninitialized Laravel app:
    Without .env, php artisan key:generate and other commands fail.

    • Fix: Copy .env.example to .env if needed, generate app key, cache config, and run migrations.

Why It Matters

Without these steps, fresh containers fail to start properly unless manually set up. These changes make the container self-initializing and reduce setup time for new developers or CI environments.

How to Test

  1. Build and run the container:
    docker-compose up --build
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
1 participant