version: "3.7"
services:
  joplin:
    image: etechonomy/joplin-server:latest
    container_name: joplin-server
    environment:
      - APP_BASE_URL=${URL}
      - APP_PORT=${__PORT__}
      - POSTGRES_PASSWORD=${POSTGRES_PASSWORD}
      - POSTGRES_DATABASE=${POSTGRES_DATABASE}
      - POSTGRES_USER=${POSTGRES_USER}
      - POSTGRES_PORT=5432
      - POSTGRES_HOST=joplin-db
      - DB_CLIENT=pg

    restart: unless-stopped
    ports:
      - 22300:22300
  joplin-db:
    image: postgres:15
    container_name: joplin-db
    restart: unless-stopped
    healthcheck:
      test: ["CMD-SHELL", "pg_isready -d ${POSTGRES_DB} -U ${POSTGRES_USER}"]
    ports:
      - 5432:5432
    volumes:
      - /foo/bar/joplin-data:/var/lib/postgresql/data
    environment:
       POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
       POSTGRES_USER: ${POSTGRES_USER}
       POSTGRES_DB: ${POSTGRES_DB}
