A server equiped with apache and PHP 8.2. Intended to be used with docker-compose and a MySQL container.
Below, subsititue yourproject
with the name of your project.
Create a docker-compose.yml
file in your project root:
version: '3'
services:
web:
image: dynamicagency/silverstripe-docker
working_dir: /var/www
ports:
- 8080:80
volumes:
- .:/var/www
- ./public:/var/www/html
database:
image: mysql
volumes:
- db-data:/var/lib/mysql
restart: always
environment:
- MYSQL_ALLOW_EMPTY_PASSWORD=true
volumes:
db-data:
In terminal, bring the Docker containers up:
docker-compose up -d
For Silverstripe projects:
# DB credentials
SS_DATABASE_SERVER="database"
SS_DATABASE_USERNAME="root"
SS_DATABASE_PASSWORD=""
SS_DATABASE_NAME="yourproject"
SS_BASE_URL="http://localhost:8080/"
In your browser, navigate to localhost port 8080
http://localhost:8080
Get the project name:
docker ps
Connect to the web container:
docker exec -it yourproject-web-1 bash
mysql -u root -h database yourproject
docker-compose stop
or
docker-machine stop yourproject