Skip to content

Instantly share code, notes, and snippets.

@josfaber
Last active November 20, 2021 16:05
Show Gist options
  • Save josfaber/01ec25193e33976fe7494ce15d98f06d to your computer and use it in GitHub Desktop.
Save josfaber/01ec25193e33976fe7494ce15d98f06d to your computer and use it in GitHub Desktop.
Docker compose for custom Wordpress image and MySQL database
version: '3.1'
services:
wp:
container_name: wordpress
build: .
ports:
- 8080:80
restart: always
environment:
IS_DOCKER: 'true'
WORDPRESS_DB_HOST: db
WORDPRESS_DB_USER: user1
WORDPRESS_DB_PASSWORD: password1
WORDPRESS_DB_NAME: database1
WORDPRESS_TABLE_PREFIX: wp_
depends_on:
- db
links:
- db:mysql
volumes:
- ./public:/var/www/html
- ./env:/mnt/env
db:
container_name: mysql
image: mysql:5.7
restart: always
ports:
- "3307:3306"
environment:
MYSQL_DATABASE: database1
MYSQL_USER: user1
MYSQL_PASSWORD: password1
MYSQL_ROOT_PASSWORD: letmein
volumes:
- ./db:/var/lib/mysql
volumes:
wordpress:
db:
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment