forked from ghostmkg/Recipe-Hub
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
26 lines (23 loc) · 1.01 KB
/
docker-compose.yml
File metadata and controls
26 lines (23 loc) · 1.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
version: '3.8' # Specify the Compose file format version
services:
web:
build: . # Build the image from the current directory (where the Dockerfile is located)
ports:
- "8000:80" # Map host port 8000 to container port 80
volumes:
- ./app:/var/www/html # Mount the local 'app' directory into the container
depends_on:
- db # Ensure the 'db' service starts before 'web'
environment:
DATABASE_URL: "mysql://user:password@db:3306/mydatabase" # Example environment variable
db:
image: mysql:8.0 # Use the official MySQL 8.0 image from Docker Hub
environment:
MYSQL_ROOT_PASSWORD: "mysecretpassword" # Set the root password for MySQL
MYSQL_DATABASE: "mydatabase" # Create a default database
MYSQL_USER: "user" # Create a default user
MYSQL_PASSWORD: "password" # Set the password for the default user
volumes:
- db_data:/var/lib/mysql # Persist database data to a named volume
volumes:
db_data: # Define the named volume for database persistence