version: '3.9'
services:
  ibm-server:
    container_name: ibm-fhir
    image: ibmcom/ibm-fhir-server
    ports:
      - "9443:9443"
    depends_on:
      - nginx
      - keycloak
    environment:
      - BOOTSTRAP_DB=true
    volumes: 
      - ./defaultServer/server.xml:/opt/ol/wlp/usr/servers/defaultServer/server.xml
      - ./defaultServer/configDropins:/opt/ol/wlp/usr/servers/defaultServer/configDropins
      - ./defaultServer/config:/opt/ol/wlp/usr/servers/defaultServer/config
      - ./defaultServer/resources/security/Cert.p12:/opt/ol/wlp/usr/servers/defaultServer/resources/security/Cert.p12
      - ./defaultServer/resources/security/CertKeycloak.p12:/opt/ol/wlp/usr/servers/defaultServer/resources/security/CertKeycloak.p12
    networks:
      example:
        ipv4_address: 155.6.0.1
  
  nginx:
    container_name: nginx
    image: 'jc21/nginx-proxy-manager:latest'
    restart: unless-stopped
    ports:
      - '80:80'
      - '81:81'
      - '443:443'
    volumes:
      - ./data:/data
      - ./letsencrypt:/etc/letsencrypt
    networks:
      example:
        ipv4_address: 155.6.0.2

  keycloak:
    image: jboss/keycloak:latest
    container_name: keycloak
    depends_on:
      - db_keycloak
    ports:
      - 8080:8080
      - 8443:8443
    environment:
        KEYCLOAK_LOGLEVEL: INFO
        DB_VENDOR: postgres
        DB_ADDR: db_keycloak
        DB_DATABASE: postgres
        DB_USER: sa
        DB_PASSWORD: password
        KEYCLOAK_USER: user
        KEYCLOAK_PASSWORD: password
    restart: unless-stopped
    volumes:
      - ./certificates-keycloak/:/etc/x509/https/ 
    networks:
      example:
        ipv4_address: 155.6.0.4

  db_keycloak:
    image: postgres:13
    container_name: db_keycloak
    volumes:
        - ./db_keycloak:/var/lib/postgresql/data
    environment:
        POSTGRES_USER: sa
        POSTGRES_PASSWORD: password
    restart: unless-stopped
    networks:
      example:
        ipv4_address: 155.6.0.5

networks:
  example:
    driver: bridge
    ipam:
      config:
        - subnet: 155.6.0./16
