.
├── src
│ └── mysql-files
├── var
│ └── lib
│ └── mysql
└── workspace
├── docker.local
│ └── bin
└── www
├── php8.localhost
│ └── public
└── tendopay.localhost
└── public
brew install coreutils
brew install mysql-client
echo 'export PATH="/usr/local/opt/mysql-client/bin:$PATH"' >> ~/.zshrc
mkdir -p $HOME/src/mysql-files
mkdir -p $HOME/var/lib/mysql
mkdir -p $HOME/var/lib/data.ms
mkdir -p $HOME/workspace/www/php8.localhost/public
mkdir -p $HOME/workspace/www/tendopay.localhost/public
brew install dnsmasq
- Create dnsmasq conf
mkdir -p $HOME/.config/valet
cat<<EOF > $HOME/.config/valet/dnsmasq.conf
# Local development server (custom setting)
address=/.localhost/127.0.0.1
port=53
EOF
- Start dnsmasq
brew tap homebrew/services
sudo brew services start dnsmasq
- Add .localhost resolver
sudo mkdir -pv /etc/resolver
sudo bash -c 'echo "nameserver 127.0.0.1" > /etc/resolver/localhost'
- Flush DNS cache
sudo dscacheutil -flushcache
sudo killall -HUP mDNSResponder
mkdir -p $HOME/src/mysql-files
mkdir -p $HOME/var/lib/mysql
mkdir -p $HOME/var/lib/data.ms
mkdir -p $HOME/workspace/www/php8.localhost/public
mkdir -p $HOME/workspace/www/tendopay.localhost/public
cd workspace
https://github.com/tangoslee/docker.local/archive/refs/tags/v0.1.1.tar.gz
tar xvfz v0.1.1.tar.gz
mv docker.local-0.1.1 docker.local
cd docker.local
cp .env.example .env
# echo $UID
USER_UID=1000
# whoami
USER=tangos
# For Window
#HOME=C:\Users\tangos
# For Ubuntu
HOME=/home/tangos
# For Mac
#HOME=/Users/tangos
DATA_DIR=${HOME}/var/lib
APP_DIR=${HOME}/workspace/www
TMP_DIR=/tmp
LOG_DIR=./logs
DB_DUMP_DIR=${HOME}/src/mysql-files
CONTAINER_HOME=/home/${USER}
# DB
DB_HOST=db.localhost
DB_PORT=3306
DB_DATABASE=forge
DB_USERNAME=forge
DB_PASSWORD=forge
# REDIS
REDIS_PORT=6379
# MEILISEARCH
MEILISEARCH_PORT=7700
MEILISEARCH_DATA=${DATA_DIR}/data.ms
MEILISEARCH_KEY=masterKey
# Resource
PHP_MEMORY_LIMITS=2G
PHP8_MEMORY_LIMITS=2G
MYSQL_MEMORY_LIMITS=4G
NGIX_MEMORY_LIMITS=128M
REDIS_MEMORY_LIMITS=16M
MEILSEARCH_MEMORY_LIMITS=512M
cd docker.local
docker-compose up --build -d
Once the containers are built, they can be managed through the Docker Desktop
cd docker.local
start.bat
cd docker.local
./start.sh --build
Tutorial (Setting https://tendopay.localhost)
cd docker.local
./bin/create_db.sh tendopay
mkdir -p $HOME/workspace/www/tendopay.local/public
cat<<EOF> $HOME/workspace/www/tendopay.local/public/index.php
<?php
$DB_HOST='db.localhost';
$DB_PORT=3306;
$DB_DATABASE='forge';
$DB_USERNAME='forge';
$DB_PASSWORD='forge';
$options = [
\PDO::ATTR_DEFAULT_FECTH_MODE => \PDO::FETCH_OBJ,
\PDO::ATTR_ERRMODE => \PDO::ERRMODE_EXCEPTION
];
$dsn = sprintf('mysql:dbname=%s;host=%s', $DB_DATABASE, $DB_HOST);
$pdo = new \PDO($dsn, $DB_USERNAME, $DB_PASSWORD, $options);
$date = $pdo->query("SELECT NOW()")->fetch();
print_r($date);
EOF
https://tendopay.localhost