/
docker-compose.yml
executable file
·78 lines (72 loc) · 2.48 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
66
67
68
69
70
71
72
73
74
75
76
77
78
######################################################################
# DOCKER-COMPOSE.YML - Defining the container configuration we will
# utilize for the production level application. The main difference
# between this and our local development "docker-compose.yml" file is
# that it relies upon the NGINX server while the dev version uses
# the Django development server.
######################################################################
version: '3.1'
services:
# First we will define the container for our Django application
app:
container_name: gs_app
restart: always
build:
context: ./app/ # This building process will ensure we build a
# container with all the requirements we need.
command: ./run_web.sh
volumes:
- ./app/:/code
ports:
- "9000:9000"
- "8765:8765" # useful for using the django development server
depends_on:
- postgres
expose:
- "9000"
env_file:
- .env
# Defining our NGINX Web Server container
nginx:
container_name: gs_webserver
restart: always
build:
context: ./nginx/ # We build this so we can create the log files
# and esure we use the correct configuration.
depends_on:
- app
volumes:
- ./app:/www
- /home/logs/
ports:
- "8000:8000"
# # Defining our database server container.
postgres:
container_name: gs_db
restart: always
image: postgres:12
volumes:
- pg-data:/var/lib/postgresql/data
- ./postgres:/docker-entrypoint-initdb.d/
ports:
- "5466:5432" # This allows us to examine our database
env_file:
- .env
# Defining our Redis container, which we will use for caching and
# session storage.
# redis:
# container_name: redis
# restart: always
# image: redis:latest
# expose:
# - "6379"
# # Eventually I want to use rabbitmq for my distributed task queueing processes along with Celery. So let's just make that available now.
# rabbitmq:
# image: rabbitmq:latest
# restart: always
# hostname: rabbitmq
# ports:
# - "15673:15672"
# Mapping an external data volume to be mounted on the Docker network. This will allow us to destroy and rebuild our Postgres server without loosing data.
volumes:
pg-data: {}