-
Notifications
You must be signed in to change notification settings - Fork 184
/
docker-compose.yml
131 lines (124 loc) · 3.53 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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
# Before running docker compose --profile postgres up for the first time,
# first copy the env.example file to .env and fill in the values.
# `cp env.example .env`
# (edit values as needed)
#
# Then, build and run with:
# `docker compose --profile postgres build`
# `docker compose --profile postgres up`
#
# Subsequently you should only need to run:
# `docker compose --profile postgres up`
#
# Force a full re-build with no cache from previous builds:
# `docker compose --profile postgres build --no-cache`
# `docker compose --profile postgres up`
#
# If you only changed the .env file, you can do a quick rebuild:
# `docker compose --profile postgres up --force-recreate`
#
# To stop, press CTRL+C (if not running in --detach mode), or run:
# `docker compose --profile postgres down`
#
# omit the --profile postgres flag to run without the postgres service,
# such as when using postgres on your host machine, or a remote server.
# (by default, the Makefile will include --profile postgres, unless POSTGRES_DOCKER=false in your env)
services:
server:
env_file:
- ${SERVER_ENV_FILE:-.env}
image: docker.io/compdem/polis-server:${TAG:-dev}
build:
context: ./server
dockerfile: Dockerfile
target: prod
args:
NODE_ENV: production
labels:
polis_tag: ${TAG:-dev}
depends_on:
- "file-server"
networks:
- "polis-net"
# Scale the server container to a given number of instances.
scale: 1
volumes:
# Persist logs to a volume, so they can be accessed after the container is stopped.
- server-logs:/app/logs
math:
image: docker.io/compdem/polis-math:${TAG:-dev}
build:
context: ./math
labels:
polis_tag: ${TAG:-dev}
environment:
- DATABASE_URL=${DATABASE_URL:?error}
- MATH_ENV=${MATH_ENV:-prod}
- WEBSERVER_USERNAME=${WEBSERVER_USERNAME:?error}
- WEBSERVER_PASS=${WEBSERVER_PASS:?error}
networks:
- "polis-net"
postgres:
image: docker.io/compdem/polis-postgres:${TAG:-dev}
restart: always
build:
context: ./server
dockerfile: Dockerfile-db
labels:
polis_tag: ${TAG:-dev}
environment:
- POSTGRES_DB=${POSTGRES_DB:?error}
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD:?error}
- POSTGRES_USER=${POSTGRES_USER:?error}
networks:
- "polis-net"
volumes:
- "backups:/backups"
- "postgres:/var/lib/postgresql/data"
profiles:
- postgres
nginx-proxy:
image: docker.io/compdem/polis-nginx-proxy:${TAG:-dev}
build:
context: ./file-server
dockerfile: nginx.Dockerfile
labels:
polis_tag: ${TAG:-dev}
depends_on:
- "server"
networks:
- "polis-net"
ports:
- ${HTTP_PORT:-80}:80
- ${HTTPS_PORT:-443}:443
file-server:
image: docker.io/compdem/polis-file-server:${TAG:-dev}
build:
context: ./
dockerfile: file-server/Dockerfile
labels:
polis_tag: ${TAG:-dev}
args:
EMBED_SERVICE_HOSTNAME: ${EMBED_SERVICE_HOSTNAME}
ENABLE_TWITTER_WIDGETS: ${ENABLE_TWITTER_WIDGETS:-false}
FB_APP_ID: ${FB_APP_ID}
GA_TRACKING_ID: ${GA_TRACKING_ID}
GIT_HASH: "${GIT_HASH:-placeholder}"
NODE_ENV: production
SERVICE_URL: ${SERVICE_URL}
environment:
- PORT=${STATIC_FILES_PORT:-8080}
networks:
- "polis-net"
networks:
polis-net:
volumes:
backups:
labels:
polis_tag: ${TAG:-dev}
postgres:
labels:
polis_tag: ${TAG:-dev}
server-logs:
labels:
polis_tag: ${TAG:-dev}