-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
51 lines (48 loc) · 1.6 KB
/
Copy pathdocker-compose.yml
File metadata and controls
51 lines (48 loc) · 1.6 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
# Self-host OSForms with Docker.
#
# One-time setup:
# cp .env.docker.example .env # then generate secrets + edit .env
# docker compose up
#
# The web container reads its config from .env (see env_file below), so no
# secrets live in this file. MONGODB_URI defaults to the bundled mongo service,
# so you normally only set the two secrets in .env to get running.
services:
mongodb:
image: mongo:7
restart: unless-stopped
ports:
- '27017:27017'
volumes:
- mongo_data:/data/db
healthcheck:
test: ['CMD', 'mongosh', '--quiet', '--eval', "db.adminCommand('ping')"]
interval: 10s
timeout: 5s
retries: 5
start_period: 20s
web:
build:
context: .
dockerfile: Dockerfile
args:
# NEXT_PUBLIC_* is inlined into the client bundle at build time, so it's
# read here (from .env) rather than only at runtime. Change it for your
# domain in .env, then rebuild with `docker compose up --build`.
NEXT_PUBLIC_APP_URL: ${NEXT_PUBLIC_APP_URL:-http://localhost:3000}
restart: unless-stopped
depends_on:
mongodb:
condition: service_healthy
ports:
- '3000:3000'
# All runtime config (secrets + optional integration keys) comes from .env.
# Copy .env.docker.example to .env first, or Compose will stop here.
env_file:
- .env
environment:
# Compose owns the DB wiring: point at the bundled mongo service by
# default. Override in .env (e.g. a MongoDB Atlas URI) if you want.
MONGODB_URI: ${MONGODB_URI:-mongodb://mongodb:27017/osforms}
volumes:
mongo_data: