aboutsummaryrefslogtreecommitdiffstats
path: root/docker-compose.yml
blob: 84420a7d93df5e346a28f6c0a172201932b2a5d4 (plain) (blame)
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
version: "3.8"

x-logging: &logging
  logging:
    driver: "json-file"
    options:
      max-file: "5"
      max-size: "10m"

x-restart-policy: &restart_policy
  restart: "no"

services:
  postgres:
    << : *logging
    << : *restart_policy
    image: postgres:13-alpine
    environment:
      POSTGRES_DB: pysite
      POSTGRES_PASSWORD: pysite
      POSTGRES_USER: pysite
    healthcheck:
      test: ["CMD-SHELL", "pg_isready -U pysite"]
      interval: 2s
      timeout: 1s
      retries: 5
    ports:
      - 5432:5432

  metricity:
    << : *logging
    << : *restart_policy
    depends_on: 
      postgres:
        condition: service_healthy
    build:
      context: .
      dockerfile: Dockerfile
    volumes:
      - ./logs:/metricity/logs
      - .:/metricity:ro
    env_file:
      - .env
    environment:
      DATABASE_URI: postgres://pysite:pysite@postgres/metricity