Skip to content

Latest commit

 

History

4 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 

Repository files navigation

My Laravel Docker Setup

Docker setup for a Laravel project with Apache and PHP.

  • PHP version specified in the Dockerfile.
  • MariaDB
  • phpMyAdmin is available at http://localhost:8080.
  • NodeJS and NPM are installed.
  • Laravel CLI is available.
  • Claude CLI is available for AI interactions.
  • Selenium is available for e2e testing with Laravel Dusk.
  • Configuration through .env file:
    • Project prefix for the Docker container
    • NodeJS version
    • XDebug
    • Document root

Docker setup

Rename the .env.example file to .env and adjust the environment variables as needed.

Start the Docker container with the following command:

docker-compose up --build

Stop the Docker container with:

docker-compose down

Open a terminal inside the Docker container (my-laravel-project is the project prefix defined in the .env file):

docker exec -u developer -it my-laravel-project-php-apache /bin/bash

Docker port forwarding for dev mode

For the Docker port forwarding to work when running composer run dev, you need to do some changes to composer.json and vite config:

  • In composer.json, add --host=0.0.0.0 --port=8000 to the dev script.
  • In vite.config.js, extend the server configuration:
     server: {
+        host: '0.0.0.0',                                            
+        port: 5173,                                                 
+        strictPort: true,                                           
+        hmr: {                                                      
+            host: 'localhost',                                      
+        },                                                          
         watch: {
+            usePolling: true,                                       
             ignored: ['**/storage/framework/views/**'],
         },
     },

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages