-
Notifications
You must be signed in to change notification settings - Fork 0
/
docker-compose.yml
65 lines (61 loc) · 2.19 KB
/
docker-compose.yml
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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
services:
# -- Si quieres usar postgres, descomenta las siguientes líneas
# postgres:
# image: postgres:16.3-alpine3.20
# environment:
# # POSTGRES_USER: "postgres" # ${POSTGRES_USER:-postgres} # Uncomment to set a custom username. postgres is the default created by the image
# POSTGRES_PASSWORD: "postgres" # ${POSTGRES_PASSWORD:-changeme}
# PGDATA: /data/postgres
# volumes:
# - postgres:/data/postgres
# ports:
# - "5432:5432"
# restart: always
# -- Si quieres usar pgadmin, descomenta las siguientes líneas
# pgadmin:
# container_name: pgadmin_container
# image: dpage/pgadmin4
# environment:
# PGADMIN_DEFAULT_EMAIL: ${PGADMIN_DEFAULT_EMAIL:-pgadmin4@pgadmin.org}
# PGADMIN_DEFAULT_PASSWORD: ${PGADMIN_DEFAULT_PASSWORD:-admin}
# PGADMIN_CONFIG_SERVER_MODE: "False"
# volumes:
# - pgadmin:/var/lib/pgadmin
# ports:
# - "8001:80"
# restart: unless-stopped
backend:
build:
context: . # Use the current directory as the build context
dockerfile: Dockerfile # Use the Dockerfile in the current directory
args:
- DJANGO_SETTINGS_MODULE=server.settings.dev # Set the Django settings module for build
entrypoint: ["/entrypoint.sh"] # Override the default entrypoint
command: ["sh", "-c", "python manage.py runserver 0.0.0.0:8000"]
volumes:
- ./backend/:/app/ # Mount current directory to /app in container
ports:
- "8000:8000" # Expose port 8000
depends_on:
- mysql # Depend on the MySQL service
restart: always
environment:
- DJANGO_SETTINGS_MODULE=server.settings.dev # Set the Django settings module for execution
- DB_HOST=mysql # Set the database host to the MySQL service
- DB_PORT=3306 # Set the database port to 3306 (MySQL default)
- DB_NAME=db
- DB_USER=mysql
- DB_PASSWORD=mysql
mysql:
image: mysql:8.0
environment:
MYSQL_ROOT_PASSWORD: "root"
MYSQL_DATABASE: "db"
MYSQL_USER: "mysql"
MYSQL_PASSWORD: "mysql"
ports:
- "3306:3306"
volumes:
- mysql_data:/var/lib/mysql # Persist MySQL data
volumes:
mysql_data: # Volume for MySQL data persistence