services:
  rental-contract-pdf:
    container_name: rental-contract-pdf
    image: rental-contract-pdf
    build: .
    restart: always
    expose:
      - "3001"
    environment:
      ADMIN_PASSWORD: "123456"
    volumes:
      - ./templates:/app/templates

  rental-contract-pdf-web:
    container_name: rental-contract-pdf-web
    build:
      context: .
      dockerfile: docker/nginx/Dockerfile
    image: rental-contract-pdf-web:latest
    restart: always
    depends_on:
      - rental-contract-pdf
    ports:
      - "3001:3001"
    environment:
      NGINX_PORT: 3001
      NGINX_SERVER_NAME: ${NGINX_SERVER_NAME:-_}
      SSL_CERT_DIR: /etc/nginx/certs
      SSL_CERT_FILE_NAME: ${SSL_CERT_FILE_NAME:-RSA-cert.pem}
      SSL_CHAIN_FILE_NAME: ${SSL_CHAIN_FILE_NAME:-RSA-chain.pem}
      SSL_KEY_FILE_NAME: ${SSL_KEY_FILE_NAME:-RSA-privkey.pem}
      UPSTREAM_HOST: rental-contract-pdf
      UPSTREAM_PORT: 3001
    volumes:
      - /volume1/homes/JianMiau/www/certificate:/etc/nginx/certs:ro
