Repository navigation
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
168 lines (159 loc) · 6.44 KB
/
Copy pathdocker-compose.yml
File metadata and controls
168 lines (159 loc) · 6.44 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
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
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
name: samfundet4
### Services ###
services:
### Backend Django ###
sm4_dev_database:
image: ${SM4_DEV_DB_IMAGE}
volumes:
- sm4_dev_database:/var/lib/postgresql/data
environment:
POSTGRES_DB: ${SM4_DEV_CREDENTIAL}
POSTGRES_USER: ${SM4_DEV_CREDENTIAL}
POSTGRES_PASSWORD: ${SM4_DEV_CREDENTIAL}
ports:
- "5432:5432"
healthcheck:
test: [ "CMD-SHELL", "pg_isready -U ${SM4_DEV_CREDENTIAL}" ]
interval: ${COMMON_HEALTHCHECK_INTERVAL}
timeout: ${COMMON_HEALTHCHECK_TIMEOUT}
retries: ${COMMON_HEALTHCHECK_RETRIES}
billig_dev_database:
image: ${BILLIG_DEV_DB_IMAGE}
volumes:
- billig_dev_database:/var/lib/postgresql/data
environment:
POSTGRES_DB: ${BILLIG_DEV_CREDENTIAL}
POSTGRES_USER: ${BILLIG_DEV_CREDENTIAL}
POSTGRES_PASSWORD: ${BILLIG_DEV_CREDENTIAL}
ports:
- "5433:5432"
healthcheck:
test: [ "CMD-SHELL", "pg_isready -U ${BILLIG_DEV_CREDENTIAL}" ]
interval: ${COMMON_HEALTHCHECK_INTERVAL}
timeout: ${COMMON_HEALTHCHECK_TIMEOUT}
retries: ${COMMON_HEALTHCHECK_RETRIES}
mdb_dev:
image: ${MDB_DEV_DB_IMAGE}
volumes:
- mdb_dev:/var/lib/postgresql/data
environment:
POSTGRES_DB: ${MDB_DEV_CREDENTIAL}
POSTGRES_USER: ${MDB_DEV_CREDENTIAL}
POSTGRES_PASSWORD: ${MDB_DEV_CREDENTIAL}
ports:
- "5434:5432"
healthcheck:
test: [ "CMD-SHELL", "pg_isready -U ${MDB_DEV_CREDENTIAL}" ]
interval: ${COMMON_HEALTHCHECK_INTERVAL}
timeout: ${COMMON_HEALTHCHECK_TIMEOUT}
retries: ${COMMON_HEALTHCHECK_RETRIES}
backend:
build: ./backend # Build in the context of this directory (meaning: use Dockerfile, .dockerignore etc.)
image: samfundet-backend
depends_on:
sm4_dev_database:
condition: service_healthy
billig_dev_database:
condition: service_healthy
mdb_dev:
condition: service_healthy
mailhog:
condition: service_started
volumes:
- ./backend:/app # Mount backend folder to docker image
- /app/.venv/ # Ignore local virtual environment
- ./frontend/src/routes:/frontend/src/routes
- ./frontend/src/permissions:/frontend/src/permissions
env_file:
- ./backend/.docker.env # Environment for backend docker
environment:
- IS_DOCKER=yes
- SM4_DEV_CREDENTIAL=${SM4_DEV_CREDENTIAL}
- BILLIG_DEV_CREDENTIAL=${BILLIG_DEV_CREDENTIAL}
- MDB_DEV_CREDENTIAL=${MDB_DEV_CREDENTIAL}
- BILLIG_DEV_HOST=billig_dev_database
- MDB_DEV_HOST=mdb_dev
ports:
- '8000:8000' # django
- '5678:5678' # debugpy
### MailHog (capture outgoing email in dev) ###
mailhog:
image: mailhog/mailhog
ports:
- '1025:1025' # SMTP
- '8025:8025' # Web UI
### Frontend React ###
# Mount sync on OSX Docker VM is really slow on some systems. Perhaps run on host machine instead.
frontend:
build:
context: ./frontend
image: samfundet-frontend
volumes:
# Share project code between host machine and container to enable reload on changes.
# Excellent solution when component needs files/folders from outside context.
- ./biome.jsonc:/biome.jsonc
- ./frontend/src:/app/src
- ./frontend/biome.jsonc:/app/biome.jsonc
- ./frontend/package.json:/app/package.json
- ./frontend/index.html:/app/index.html
env_file:
- ./frontend/.env.docker # Environment for frontend docker
environment:
- IS_DOCKER=yes
- CHOKIDAR_USEPOLLING=true # Might not be needed. Used for hot reload.
ports:
- '3000:3000'
command: yarn start:docker --host 0.0.0.0 --port 3000
# TODO: Fix, ffs dont just ignore it next time it breaks
# cypress:
# depends_on:
# - frontend
# - backend
# build:
# context: ./frontend
# dockerfile: Dockerfile.cypress
# # platform: linux/arm64/v8
# env_file:
# - ./frontend/.env.docker # Environment for frontend docker
# environment:
# - IS_DOCKER=YES
# - CYPRESS_baseUrl=http://frontend:3000
# volumes:
# - ./frontend/cypress:/frontend/cypress
# command: 'yarn run cypress:run'
## Storybook React ###
storybook:
image: samfundet-frontend
volumes:
- ./frontend/src:/app/src # Share project code between host machine and container to enable reload on changes.
env_file:
- ./frontend/.env.docker # Environment for frontend docker
environment:
- IS_DOCKER=yes
- CHOKIDAR_USEPOLLING=true # Might not be needed. Used for hot reload.
ports:
- '6006:6006'
command: yarn run storybook --no-open
### Welcome Splash ###
welcome:
image: alpine:latest # Minimal image (~ 5MB)
command: |
/bin/sh -c 'sleep 5 && printf "
-------------------------------------------------------------------------------
\e[31m███████╗ █████╗ ███╗ ███╗███████╗██╗ ██╗███╗ ██╗██████╗ ███████╗████████╗
\e[31m██╔════╝██╔══██╗████╗ ████║██╔════╝██║ ██║████╗ ██║██╔══██╗██╔════╝╚══██╔══╝
\e[31m███████╗███████║██╔████╔██║█████╗ ██║ ██║██╔██╗ ██║██║ ██║█████╗ ██║
\e[31m╚════██║██╔══██║██║╚██╔╝██║██╔══╝ ██║ ██║██║╚██╗██║██║ ██║██╔══╝ ██║
\e[31m███████║██║ ██║██║ ╚═╝ ██║██║ ╚██████╔╝██║ ╚████║██████╔╝███████╗ ██║
\e[31m╚══════╝╚═╝ ╚═╝╚═╝ ╚═╝╚═╝ ╚═════╝ ╚═╝ ╚═══╝╚═════╝ ╚══════╝ ╚═╝
\e[34mBackend: http://localhost:8000
\e[34mFrontend: http://localhost:3000
\e[34mStorybook: http://localhost:6006
\e[34mMailHog: http://localhost:8025
-------------------------------------------------------------------------------
"'
### Volumes ###
volumes:
sm4_dev_database:
billig_dev_database:
mdb_dev: