Instantly share code, notes, and snippets.

Embed
What would you like to do?
Docker compose: PHP (5.4), composer, Apache, MySQL and phpMyAdmin
version: '3'
services:
api:
image: alterway/php:5.4-apache
environment:
PHP_php5enmod: 'mysqli'
HTTPD_a2enmod: 'rewrite headers'
volumes:
# ./api contains my PHP application
- "./api:/var/www/html"
ports:
- "3010:80"
depends_on:
- mysqldb
phpmyadmin:
image: phpmyadmin/phpmyadmin
ports:
- "3011:80"
environment:
PMA_HOST: mysqldb
depends_on:
- mysqldb
mysqldb:
image: mysql
volumes:
# ./db contains my-db.sql to seed my database
- ./db:/docker-entrypoint-initdb.d
environment:
MYSQL_DATABASE: my-db
MYSQL_ROOT_PASSWORD: foo
MYSQL_USER: bar
MYSQL_PASSWORD: foo
composer:
image: "composer"
volumes:
- "./api:/app"
# Install packages using: `docker: docker-compose run --rm composer composer require package-name`
command: install
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment