This project uses Docker and Laravel Sail to provide a consistent development environment. It includes services for running a Laravel app and a PostgreSQL database.
Make sure you have the following installed:
git clone https://github.com/Yoru-cyber/sistema-consultorio.git
cd project-name
Copy the example .env
file and adjust environment variables if necessary.
cp .env.example .env
Make sure the database environment variables match the configuration for the PostgreSQL service:
DB_CONNECTION=pgsql
DB_HOST=pgsql
DB_PORT=5432
DB_DATABASE=your_database_name
DB_USERNAME=your_database_user
DB_PASSWORD=your_database_password
Use Laravel Sail to start the Docker containers, if the containers aren't built this command will do it automatically:
./vendor/bin/sail up
To render correctly the client, you need to run this too:
./vendor/bin/sail npm run dev
Now if you run this command
Docker ps
You should have this services running:
- laravel.test (Laravel application)
- pgsql (PostgreSQL database)
Migrate the database using Laravel's migration system:
./vendor/bin/sail artisan migrate
The Laravel app will be accessible at http://localhost
by default. If you have modified the APP_PORT
environment variable, use that port instead.
If you are running Vite for frontend assets, it will be accessible at http://localhost:5173
.
To stop and remove the containers, run:
./vendor/bin/sail stop
-
Access the Laravel container:
./vendor/bin/sail shell
-
Run PHPUnit tests:
./vendor/bin/sail test
-
Rebuild the containers:
If you make changes to the Dockerfile or environment, you may need to rebuild the containers:
./vendor/bin/sail build