Skip to content

Development playground in Docker with PHP and SQL

License

Notifications You must be signed in to change notification settings

lode/playground

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

26 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Dev Playground with Docker

The files from this repository can be added to any other project to run it inside Docker.

It is a base from phpdocker.io with some additions

  • Non-root user inside Docker
  • No issues with file ownership
  • .env file for configuring Apache & MySQL
  • Scripts to easily manage Docker (install, start, logs, console)
  • Example code for connecting to the database

This repository works well together with lode/linting-scripts.

Install

To get started clone the repository and open a terminal inside the repository directory.

  • Install: Docker Desktop on Mac, Docker Engine is enough for Linux

    • Mac: no need to sign in with a Docker account when the installer asks you to.
    • Mac: under 'Settings' -> 'General' disable 'SBOM indexing'.
    • Mac: use ./script/* for managing docker instead of the control panel of Docker Desktop for Mac.
    • Linux: follow Docker post-installation to manage docker without root.
  • Run ./script/setup

  • Run ./script/server

Usage after first setup

Connect to the database

Connect to the database from outside Docker:

  • hostname: localhost
  • port: see SQL_PORT_EXTERNAL in docker.env
  • username/password: see values in docker.env

For managing databases:

  • username: root
  • password: root-secret

To Do

  • Upgrade mysql
  • Add custom bashrc
  • Setup XDebug