Über uns
A containerized Laravel application
Web- und App-EntwicklungGemessener Sternzuwachs
- in 24h
- 0
- in 7 days
- 0
- in 15 days
- 0
- in 1 month
- Verlauf wird gesammelt
Nettoänderungen in überlappenden Zeiträumen, keine Tagessummen. Fehlende Messwerte bleiben leer. Sterne zeigen Interesse, nicht Qualität.
README.md
OriginalContainerized PHP Application
What is this?
This is an example of how you can quickly get up and running with Docker to develop a PHP application. This is a companion to the 🐳 Shipping Docker video series.
Teach me how to use it!
I have a mini-course that uses this example to show you how to get up and running in Docker for development!
Sign up here to get an email with a link to the mini course to see how this works!
How to use
1. Get the files and spin up containers
# Get shipping-docker files
git clone https://github.com/shipping-docker/php-app.git
cd php-app
# Start the app, run containers
# in the background
# This will download and build the images
# the first time you run this
docker-compose up -d
At this point, we've created containers and have them up and running. However, we didn't create a Laravel application to serve yet. We waited because we wanted a PHP image to get created so we can re-use it and run composer commands.
2. Create a new Laravel application
# From directory "php-app"
# Create a Laravel application
docker run -it --rm \
-v $(pwd):/opt \
-w /opt \
--network=phpapp_appnet \
shippingdocker/php \
composer create-project laravel/laravel application
docker run -it --rm \
-v $(pwd)/application:/opt \
-w /opt \
--network=phpapp_appnet \
shippingdocker/php \
composer require predis/predis
# Restart required to ensure
# app files shares correctly
docker-compose restart
Edit the application/.env file to have correct settings for our containers. Adjust the following as necessary:
DB_CONNECTION=mysql
DB_HOST=db
DB_PORT=3306
DB_DATABASE=homestead
DB_USERNAME=homestead
DB_PASSWORD=secret
BROADCAST_DRIVER=log
CACHE_DRIVER=redis
SESSION_DRIVER=redis
QUEUE_DRIVER=sync
REDIS_HOST=redis
REDIS_PASSWORD=null
REDIS_PORT=6379
If you already have an application, you can move it to the
applicationdirectory here. Else, you can adjust the shared volume file paths within thedocker-compose.ymlfile.If you edit the
docker-compose.ymlfile, rundocker-compose down; docker-compose up -dto suck in the new Volume settings.
NOTE: If you're not running Docker Mac/Windows (which run Docker in a small virtualized layer), you may need to set permissions on the shared directories that Laravel needs to write to. The following will let Laravel write the storage and bootstrap directories:
# From directory php-app
chmod -R o+rw application/bootstrap application/storage
3. (Optionally) Add Auth Scaffolding:
If you'd like, we can add Laravel's Auth scaffolding as well. To do that, we need to run some Artisan commands:
# Scaffold authentication views/routes
docker run -it --rm \
-v $(pwd)/application:/opt \
-w /opt \
--network=phpapp_appnet \
shippingdocker/php \
php artisan make:auth
# Run migrations for auth scaffolding
docker run -it --rm \
-v $(pwd)/application:/opt \
-w /opt \
--network=phpapp_appnet \
shippingdocker/php \
php artisan migrate
Now we can start using our application! Head to http://localhost/register to see your Laravel application with auth scaffolding in place.

Ähnliche Projekte entdecken
Wird geladen…

