Skip to content

Instantly share code, notes, and snippets.

@ayoubbensakhria
Created August 4, 2020 10:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ayoubbensakhria/b647accad211cb2d3ad29d6ffc69bc60 to your computer and use it in GitHub Desktop.
Save ayoubbensakhria/b647accad211cb2d3ad29d6ffc69bc60 to your computer and use it in GitHub Desktop.
version: "3.2"
services:
php:
build:
context: './php/'
args:
PHP_VERSION: ${PHP_VERSION}
networks:
- backend
volumes:
- ${PROJECT_ROOT}/:/var/www/html/
container_name: php
links:
- mysql
apache:
build:
context: './apache/'
args:
APACHE_VERSION: ${APACHE_VERSION}
depends_on:
- php
- mysql
links:
- mysql
networks:
- frontend
- backend
ports:
- "8080:80"
volumes:
- ${PROJECT_ROOT}/:/var/www/html/
container_name: apache
mysql:
image: mysql:${MYSQL_VERSION}
command: --default-authentication-plugin=mysql_native_password
restart: always
ports:
- "3306:3306"
volumes:
- data:/var/lib/mysql
networks:
- backend
# The default MySQL installation only creates the "root" administrative account
# create new users using docker-compose exec
environment:
MYSQL_ROOT_PASSWORD: "${DB_ROOT_PASSWORD}"
MYSQL_DATABASE: "${DB_NAME}"
MYSQL_USER: "${DB_USERNAME}"
MYSQL_PASSWORD: "${DB_PASSWORD}"
container_name: mysql
phpmyadmin:
depends_on:
- mysql
links:
- mysql
image: phpmyadmin/phpmyadmin
restart: always
ports:
- '8081:80'
environment:
PMA_HOST: mysql
MYSQL_USERNAME: "${DB_USERNAME}"
MYSQL_ROOT_PASSWORD: "${DB_ROOT_PASSWORD}"
networks:
- backend
volumes:
- /sessions
container_name: phpmyadmin
networks:
frontend:
backend:
volumes:
data:
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment