services:
  joplin-db:
    image: postgres:16-alpine
    restart: unless-stopped
    environment:
      POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
      POSTGRES_USER: ${POSTGRES_USER}
      POSTGRES_DB: ${POSTGRES_DATABASE}
    volumes:
      - joplin_db_data:/var/lib/postgresql/data

  joplin-server:
    image: joplin/server:3.7.1
    restart: unless-stopped
    depends_on:
      - joplin-db
    environment:
      APP_BASE_URL: ${APP_BASE_URL}
      APP_PORT: ${APP_PORT}
      DB_CLIENT: pg
      POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
      POSTGRES_DATABASE: ${POSTGRES_DATABASE}
      POSTGRES_USER: ${POSTGRES_USER}
      POSTGRES_PORT: 5432
      POSTGRES_HOST: joplin-db
    ports:
      - "22300"

volumes:
  joplin_db_data:
