Mark Shust's Docker Configuration for Lumen
View Dockerfiles:
This configuration is intended to be used as a Docker-based development environment for Lumen.
Folders:
images
: Docker imagescompose
: sample setups with Docker Compose
- Setup a new project sekeleton from this repository:
mkdir myapp && cd $_
git init
git remote add origin [email protected]:markoshust/docker-lumen.git
git fetch origin
git checkout origin/master -- compose
mv compose/* .
rm -rf compose .git
git init
-
Setup your ip loopback for proper IP resolution with Docker:
./bin/initloopback
-
Add an entry to
/etc/hosts
with your custom domain:10.254.254.254 myapp.test
(assuming the domain you want to setup ismyapp.test
). Be sure to use a.test
tld, as.localhost
and.dev
will present issues with domain resolution. -
Start your Docker containers with:
./bin/start
. -
Download Lumen within the running Docker container with composer:
./bin/composer create-project --prefer-dist laravel/lumen .
-
You may now access your site at
http://myapp.test:8000
(or whatever domain you setup).
Your source code should go in the src
folder, and you can then kick your project off with ./bin/start
.
./bin/bash
: Drop into the bash prompt of your Docker container. Thephpfpm
container should be mainly used to access the filesystem within Docker../bin/cli
: Run any CLI command without going into the bash prompt. Ex../bin/cli ls
./bin/composer
: Run the composer binary. Ex../bin/composer install
./bin/initloopback
: Setup your ip loopback for proper Docker ip resolution../bin/start
: Start the Docker Compose process and your app. Ctrl+C to stop the process.
- The hostname of each service is the name of the service within the
docker-compose.yml
file. So for example, MySQL's hostname isdb
(notlocalhost
) when accessing it from a Docker container.
The ~/.composer
directory is bind-mounted to the container as a volume, so you can setup your ~/.composer/auth.json
file on the host with the following contents, like so:
{
"http-basic": {
"your-repo.com": {
"username": "YOUR_USERNAME",
"password": "YOUR_PASSWORD"
}
}
}
...then, your authentication credentials will also work within the running Docker container.