-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathproduction.yml
68 lines (63 loc) · 2.12 KB
/
production.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
66
67
68
version: "3"
services:
# The web service is your Django application.
web:
build:
# The context is the directory containing the Dockerfile.
context: ./src/
# The command to start your Django application.
# I'm using Gunicorn here, but you could use anything.
command: gunicorn MarBlazeShop.wsgi:application --bind 0.0.0.0:8000
volumes:
# Mount the application code into the container.
# This is useful for development, as it lets you edit code without rebuilding the image.
- ./src/:/usr/src/app/
# These volumes store your application's static and media files.
# They are kept separate so they can be served by a different server in production.
- static_files:/usr/src/app/static
- media_files:/home/app/media/
ports:
# Expose port 8000 in the container to port 8000 on the host machine.
- 8000:8000
env_file:
# Use environment variables from a .env file.
# This is where you should put any secrets, like your SECRET_KEY.
- ./src/prod.env
depends_on:
# This ensures the database service is started before the web service.
- db
# The db service is your database.
db:
image: postgres:latest
restart: always
# env_file:
# - src/.env
ports:
- "5432:5432"
volumes:
# This volume stores your database data. It allows data to persist across container restarts.
- postgres_data:/var/lib/postgresql/data/
environment:
# These environment variables set up the initial database and user.
- POSTGRES_DB=postgres
- POSTGRES_USER=postgres
- POSTGRES_PASSWORD=postgres
# A friendly name for the container.
container_name: MarBlazeShop_prod_postgres_db
nginx:
build:
context: ./nginx/
ports:
- 80:80
volumes:
- ./nginx/conf.d/:/etc/nginx/conf.d/
- static_files:/home/app/static/
- media_files:/home/app/media/
depends_on:
- web
# These are the volumes used above.
# In a development environment, these will be created as anonymous volumes.
volumes:
static_files:
media_files:
postgres_data: