-
Notifications
You must be signed in to change notification settings - Fork 93
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
63 lines (56 loc) · 1.79 KB
/
docker-compose.yml
File metadata and controls
63 lines (56 loc) · 1.79 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
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
version: '2'
services:
# Postgres container
postgres:
# Getting official postgres image
image: postgres:9.4
# Taking password, databasename, etc from the env variables file
env_file: ./backend/config/env
# Creating a volume to preserve database data
volumes:
- ./pgdata:/var/lib/postgresql/data
# Backend API container
backend:
# Build by using Dockerfile in this directory
build: ./backend
# Name the container to easily attach to it
container_name: backend
# Create a volume so I could edit the code without rebuilding container
volumes:
- ./backend:/home/blog/backend
# Taking password, databasename, etc from the env variables file
env_file: ./backend/config/env
# Switch to this directory
working_dir: /home/blog/backend
# Run this command on start up, to launch a supervisor
command: supervisord -n
# Connect it to the postgres container
depends_on:
- postgres
links:
- postgres
# Frontend container (static React files, index.html and bundle.js, served with nginx)
frontend:
build: ./frontend
volumes:
- ./frontend:/home/blog/frontend
container_name: frontend
working_dir: /home/blog/frontend
container_name: frontend
# Links to the backend so that nginx could pass certain
# urls(like /media or /feed/rss) to the backend
links:
- backend
# This container sits in front of the others,
# I need it because both frontend and backend containers
# can't connect to the port 80 at the same time
nginx_proxy:
build: ./nginx_proxy
container_name: nginx_proxy
# See the file nginx_proxy.conf
# It uses these links to connect you to the two containers
links:
- backend
- frontend
ports:
- '80:80'