services:
  database:
    image: postgres:17-alpine
    container_name: codimd_database
    environment:
      - POSTGRES_USER=codimd
      - POSTGRES_PASSWORD=C0d1MdP@ss2025
      - POSTGRES_DB=codimd
    volumes:
      - "database-data:/var/lib/postgresql/data"
    restart: always
    labels:
      - "com.centurylinklabs.watchtower.enable=true"
    networks:
      - codimd_net

  codimd:
    image: hackmdio/hackmd:latest
    container_name: codimd_app
    environment:
      - CMD_DB_URL=postgres://codimd:C0d1MdP@ss2025@database/codimd
      - CMD_USECDN=false
    depends_on:
      - database
    ports:
      - "3001:3000"
    volumes:
      - upload-data:/home/hackmd/app/public/uploads
    restart: always
    labels:
      - "com.centurylinklabs.watchtower.enable=true"
    networks:
      - codimd_net

volumes:
  database-data: {}
  upload-data: {}

networks:
  codimd_net:
    driver: bridge

