A sandbox for developing laravel applications.
> php: 8.2.1-fmp-alpine.3.17
> nginx: 1.23-3-alpine
> mysql: 8.0.32
PHP modules
> 🐼 laravel-docker git:(main) ✗ docker exec -ti laravel-app-php /usr/local/bin/php -m
[PHP Modules]
apcu
bcmath
Core
ctype
curl
date
dom
fileinfo
filter
ftp
hash
iconv
intl
json
libxml
mbstring
mysqlnd
openssl
pcntl
pcre
PDO
pdo_mysql
pdo_sqlite
Phar
posix
random
readline
Reflection
session
SimpleXML
sodium
SPL
sqlite3
standard
tokenizer
xdebug
xml
xmlreader
xmlwriter
Zend OPcache
zip
zlib
[Zend Modules]
Xdebug
Zend OPcache
- Automatic HTTPS.
- HTTP/2 support.
- XDebug integration.
- Clean and easy setup.
- Well-structured.
> git clone git@github.com:andrew-kandyba/laravel-docker.git
> 🐼 laravel-docker git:(main) rm -rf .git/
> 🐼 laravel-docker git:(main) rm -rf .github/
> make build-laravel
Fresh laravel project will be created into ./application
directory, it can be changed via $LARAVEL_DIRECTORY
.
Note Please see config and build-laravel for more info.
> make build
Will be created: laravel-app/mysql
, laravel-app/nginx
, laravel-app/php
.
> 🐼 laravel-docker git:(main) ✗ docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
laravel-app/php development f8cde6e5a0f7 43 minutes ago 122MB
laravel-app/nginx development 5ca2bb4b6959 46 minutes ago 13.8MB
laravel-app/mysql development 4b49e5f0f347 46 minutes ago 517MB
You may change image repository part (laravel-app...
) via $PROJECT
.
> make start
Will be created: laravel-app-mysql
, laravel-app-nginx
, laravel-app-php
.
> 🐼 laravel-docker git:(main) ✗ docker ps --format "table {{.Names}}\t{{.Ports}}\t{{.Image}}"
NAMES PORTS IMAGE
laravel-app-nginx 0.0.0.0:80->80/tcp, 0.0.0.0:443->443/tcp laravel-app/nginx:development
laravel-app-php 9000/tcp laravel-app/php:development
laravel-app-mysql 3306/tcp, 33060/tcp laravel-app/mysql:development
You may change container name (laravel-app...
) via $PROJECT
.
Also will be created a ssl certificate (need mkcert) for laravel-app.localhost
, it can be changed via $LOCALHOST_DOMAIN
.
Note Please see config and start + .generate-ssl for more info.
> make stop
Applications containers + resources (ssl, volumes...etc) will be stopped and deleted.
Note Please see stop for more info.
To see a list of available commands:
> make
build Building application images.
build-laravel Building laravel-app skeleton.
start Create and start application containers.
stop Stop and remove containers and resources.
shell Get shell inside php container.
./laravel-env.example
- laravel application config.
./docker.env
- environment variables.
Name | Default | Comment |
---|---|---|
HTTP_PORT | 80 | Host mapped port (nginx). |
HTTPS_PORT | 443 | Host mapped port (nginx). |
IMAGE_CONTEXT | $(PWD)/environment/containers/. |
Docker build context |
IMAGE_LABEL | development | Docker build target |
LARAVEL_DIRECTORY | $(PWD)/application |
Laravel app directory |
LOCALHOST_DOMAIN | laravel-app.localhost | Application domain (mkcert) |
MYSQL_DATABASE | laravel-app-db | Application database (mysql) |
MYSQL_PORT | 3306 | Application database port (mysql) |
MYSQL_ROOT_PASSWORD | i_am_root | Application database password (mysql) |
PROJECT | laravel-app | Project label (used by for images/containers naming) |