-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from Anthony14FR/Release-01
Using now nginx with nginx conf and fix somes bugs
- Loading branch information
Showing
5 changed files
with
84 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,39 +1,25 @@ | ||
.PHONY: setup docker-build laravel-install app-install update-env key-generate migrate down | ||
setup: build laravel-setup key-generate migrate | ||
|
||
# Définition de la commande par défaut | ||
setup: docker-build laravel-install app-install update-env key-generate migrate | ||
build: | ||
docker-compose down -v | ||
docker-compose up -d --build | ||
|
||
# Construction des images Docker | ||
docker-build: | ||
docker compose down -v && docker-compose up -d --build | ||
laravel-setup: laravel-install update-env | ||
|
||
# Installation de Laravel via Composer | ||
laravel-install: | ||
if [ ! -d "app" ]; then \ | ||
mkdir -p app && cd app && composer create-project --prefer-dist laravel/laravel . ; \ | ||
fi | ||
|
||
# Installation des dépendances de Laravel (Utilisable après la première installation si nécessaire) | ||
app-install: | ||
cd app && composer install | ||
[ -d "laravel-project" ] || (mkdir -p laravel-project && cd laravel-project && composer create-project --prefer-dist laravel/laravel . && cd ..) | ||
cd laravel-project && composer install | ||
|
||
update-env: | ||
cp .env.example app/.env | ||
cp .env.example laravel-project/.env | ||
|
||
# Génération de la clé d'application Laravel | ||
key-generate: | ||
docker-compose exec app php artisan key:generate | ||
|
||
# Migration de la base de données | ||
migrate: | ||
docker-compose exec app php artisan migrate | ||
|
||
# Arrêt des conteneurs Docker | ||
down: | ||
docker-compose down -v | ||
|
||
reload: | ||
docker-compose down -v && docker-compose up -d | ||
|
||
build: | ||
docker-compose down -v && docker-compose up -d --build | ||
reload: down build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,67 @@ | ||
# LaravelWithDockerSingleCommand | ||
# Laravel with Docker - Single Command Setup | ||
|
||
## Prerequisites | ||
|
||
Before you begin, ensure you have installed all of the following on your development machine: | ||
- Docker and Docker Compose | ||
- Make (for using the `Makefile` commands) | ||
|
||
|
||
## Getting Started | ||
|
||
To get your Dockerized Laravel environment up and running, follow these steps: | ||
|
||
1. **Clone the Repository** | ||
|
||
Start by cloning this repository to your local machine: | ||
|
||
```sh | ||
git clone [email protected]:Anthony14FR/LaravelWithDockerSingleCommandSetup.git | ||
``` | ||
|
||
2. **Run the Setup Command** | ||
|
||
Navigate to the root directory of the cloned repository and run the setup command: | ||
|
||
```sh | ||
make setup | ||
``` | ||
|
||
This command builds the Docker images, creates a new Laravel project, and sets up the environment. | ||
|
||
3. **Access Your Laravel Application** | ||
|
||
After the setup is complete, your Laravel application will be accessible at `http://localhost:8080`. | ||
|
||
|
||
## Features | ||
|
||
- **Dockerized Environment**: Includes configurations for `app` (PHP-FPM), `db` (MySQL), and `nginx` as a web server. | ||
- **Automatic Laravel Installation**: Automates the installation and setup of a new Laravel project. | ||
- **Environment Customization**: Easy customization through `.env` files and Docker Compose configurations. | ||
- **Simplified Commands**: Utilizes a `Makefile` for common tasks such as setup, teardown, and environment management. | ||
|
||
|
||
## Makefile Commands | ||
|
||
The `Makefile` includes several commands to simplify the management of your Docker environment: | ||
|
||
- `make setup`: Initializes the environment and sets up the Laravel project. | ||
- `make build`: Builds or rebuilds services defined in `docker-compose.yml`. | ||
- `make down`: Stops and removes containers, networks, and volumes. | ||
- `make reload`: Stops all services and starts them again. | ||
- `make key-generate`: Generates a new application key for Laravel. | ||
- `make migrate`: Runs the database migrations. | ||
|
||
## Customization | ||
|
||
You can customize your Laravel and Docker setup by editing the `.env` files for Laravel and modifying the `docker-compose.yml` file according to your requirements. | ||
|
||
## Troubleshooting | ||
|
||
- If you encounter any issues during the setup process, ensure Docker and Docker Compose are correctly installed and up-to-date. | ||
- Check the Docker and application logs for any errors that might indicate what went wrong. | ||
|
||
## License | ||
|
||
This project is open-sourced under the MIT License. See the LICENSE file for more information. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters