Docker Compose environment, based on Alpine Linux.
Made to be a very fast & simple macOS php development environment.
Spin up a new environment in <= 10 seconds (after you have the base images downloaded)
Including:php-fpm, MySql,, Singlestore, Redis, Nginx, Mailhog, Composer, node, npm & yarn
Deafults to Singlestore DB.
- Mailhog:
- Singlestore UI:
Docker environment can be configured in .env.phpdock.
Easily swap out images and configure docker separate from your application .env.
Use any of these in .env.phpdock, to customize your environment:
- PHP-fpm: 8.3-latest
- MySql Server: any valid mysql tag between 5.7 - 8.x
- singlestore: always latest version
- redis: always latest version
To customize more, you can always edit the docker-compose,yml.
composer require madsem/phpdock --devThen run vendor/bin/phpdock publish, to publish the docker/ folder and phpdock files into your project directory.
Then you can start using the executable shell script like so:
vendor/bin/phpdock <command>
# bashalias phpdock="./vendor/bin/phpdock"# fishalias phpdock "./vendor/bin/phpdock"phpdock buildThis will build the containers for your project.
After the containers are ready, run phpdock up to start the containers.
Then you can log into the app, nginx, mysql or redis services as follows:
phpdock ssh <service name>To shut down but not destroy your work, run phpdock down,
or to destroy the containers, images and associated volumes phpdock destroy.
To rebuild containers after config changes, run phpdock rebuild:
# rebuild everything
phpdock rebuild
phpdock rebuild all
# rebuild only a particular service
phpdock rebuild app
phpdock rebuild webcomposer require madsem/phpdock --dev
phpdock updateThis will publish the new phpdock files, and append .bak to old files & the docker directory.
For more commands, run phpdock help.
Laravel env file using the phpdock default configuration:
# Project ENVDB_CONNECTION=mysqlDB_HOST=mysqlDB_PORT=3306DB_DATABASE=phpdockDB_USERNAME=phpdockDB_PASSWORD=secretREDIS_HOST=redisCACHE_DRIVER=redisSESSION_DRIVER=redisQUEUE_DRIVER=redisMAIL_HOST=mailMAIL_PORT=1025app:
build:
context: ./docker/appdockerfile: Dockerfileargs:
- MY_PHP_VERSION=${PHP_VERSION}volumes:
- php-sock:/socket
- ./:/var/www/htmlnetworks:
- phpdockdepends_on:
mysql:
condition: service_healthymysql:
build:
context: ./docker/mysqldockerfile: Dockerfileargs:
- MY_MYSQL_VERSION=${MYSQL_VERSION}ports:
- ${DB_PORT:-3306}:3306volumes:
- dbdata:/var/lib/mysqlenvironment:
MYSQL_ROOT_PASSWORD: "${DB_PASS:-secret}"MYSQL_DATABASE: "${DB_NAME:-phpdock}"MYSQL_USER: "${DB_USER:-phpdock}"MYSQL_PASSWORD: "${DB_PASS:-secret}"MYSQL_ALLOW_EMPTY_PASSWORD: "yes"networks:
- phpdockhealthcheck:
test: ["CMD", "mysqladmin", "ping", "-h", "localhost"]timeout: 45sinterval: 10sretries: 5Connect to DB Management software like TablePlus, like this:
[PHP Modules]
bcmath
Core
ctype
curl
date
dom
exif
fileinfo
filter
ftp
gd
hash
iconv
imagick
intl
json
libxml
maxminddb
mbstring
mysqlnd
openssl
pcre
PDO
pdo_mysql
pdo_sqlite
Phar
posix
readline
redis
Reflection
session
SimpleXML
soap
sodium
SPL
sqlite3
standard
tokenizer
xml
xmlreader
xmlwriter
zip
zlibphpDock uses https://github.com/mlocati/docker-php-extension-installer#supported-php-extensions to install extensions.
This package detects your PHP version and installs the correct version.
Simply add additional extensions or modifications to the docker/app/Dockerfile, like this:
RUN install-php-extensions \
csv \
grpc \
protobuf- Chris Fidao && Vessel
- Yuki Imamura && Docker Laravel