-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.api.yml
More file actions
49 lines (47 loc) · 1.44 KB
/
Copy pathdocker-compose.api.yml
File metadata and controls
49 lines (47 loc) · 1.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
# API server only — points at external Postgres/Redis via DATABASE_URL and REDIS_URL.
# Usage: docker compose -f docker-compose.api.yml --env-file .env up -d --build
#
# Set in .env (examples):
# DATABASE_URL=postgres://trax:SECRET@db.example.com:5432/trax?sslmode=require
# REDIS_URL=redis://:SECRET@redis.example.com:6379/0
services:
migrate:
image: migrate/migrate:v4.18.3
container_name: trax-migrate
volumes:
- ./db/migrations:/migrations:ro
command:
[
"-path",
"/migrations",
"-database",
"${DATABASE_URL}",
"up",
]
restart: "no"
api:
build:
context: .
dockerfile: Dockerfile
image: trax-api:local
container_name: trax-api
ports:
- "${API_PORT:-8080}:8080"
environment:
HTTP_ADDR: ":8080"
DATABASE_URL: ${DATABASE_URL:?DATABASE_URL is required}
REDIS_URL: ${REDIS_URL:?REDIS_URL is required}
JWT_ACCESS_SECRET: ${JWT_ACCESS_SECRET:?JWT_ACCESS_SECRET is required}
JWT_REFRESH_SECRET: ${JWT_REFRESH_SECRET:?JWT_REFRESH_SECRET is required}
ACCESS_TOKEN_TTL: ${ACCESS_TOKEN_TTL:-15m}
REFRESH_TOKEN_TTL: ${REFRESH_TOKEN_TTL:-720h}
depends_on:
migrate:
condition: service_completed_successfully
restart: unless-stopped
healthcheck:
test: ["CMD", "wget", "-qO-", "http://127.0.0.1:8080/health"]
interval: 10s
timeout: 3s
retries: 5
start_period: 5s