
#
# This is for building a local OpenEMR development and testing environment.
# (Recommend not running it from your git repo and instead mirroring your
#  git repo to a testing directory (such as your web directory).)
#
# Brief instructions on how to use (for fuller instructions and examples,
#  see the document at contrib/util/docker/README.md):
#   1. go to contrib/util/docker directory
#   2. docker-compose up -d
#   3. Choose one of any of the following links:
#        http://localhost:8080 (with Apache and PHP 7.1)
#        http://localhost:8081 (with Apache and PHP 7.2)
#        http://localhost:8082 (with Apache and PHP 7.3)
#        http://localhost:8083 (with Alpine Edge (Apache and now PHP 7.3))
#        http://localhost:8084 (with Apache and PHP 7.1 with redis)
#        http://localhost:8085 (with Apache and PHP 7.2 with redis)
#        http://localhost:8086 (with Apache and PHP 7.3 with redis)
#        http://localhost:8087 (with Alpine Edge (Apache and now PHP 7.3) with redis)
#        http://localhost:8100 (with Nginx and PHP-FPM 5.6)
#        http://localhost:8101 (with Nginx and PHP-FPM 7.0)
#        http://localhost:8102 (with Nginx and PHP-FPM 7.1)
#        http://localhost:8103 (with Nginx and PHP-FPM 7.2)
#        http://localhost:8104 (with Nginx and PHP-FPM 7.3)
#        http://localhost:8105 (with Nginx and PHP-FPM 7.4)
#        http://localhost:8150 (with Nginx and PHP-FPM 5.6 with redis)
#        http://localhost:8151 (with Nginx and PHP-FPM 7.0 with redis)
#        http://localhost:8152 (with Nginx and PHP-FPM 7.1 with redis)
#        http://localhost:8153 (with Nginx and PHP-FPM 7.2 with redis)
#        http://localhost:8154 (with Nginx and PHP-FPM 7.3 with redis)
#        http://localhost:8155 (with Nginx and PHP-FPM 7.4 with redis)
#        https://localhost:9080 with SSL (with Apache and PHP 7.1)
#        https://localhost:9081 with SSL (with Apache and PHP 7.2)
#        https://localhost:9082 with SSL (with Apache and PHP 7.3)
#        https://localhost:9083 (with Alpine Edge (Apache and now PHP 7.3))
#        https://localhost:9084 with SSL (with Apache and PHP 7.1 with redis)
#        https://localhost:9085 with SSL (with Apache and PHP 7.2 with redis)
#        https://localhost:9086 with SSL (with Apache and PHP 7.3 with redis)
#        https://localhost:9087 (with Alpine Edge (Apache and now PHP 7.3) with redis)
#        https://localhost:9100 with SSL (with Nginx and PHP-FPM 5.6)
#        https://localhost:9101 with SSL (with Nginx and PHP-FPM 7.0)
#        https://localhost:9102 with SSL (with Nginx and PHP-FPM 7.1)
#        https://localhost:9103 with SSL (with Nginx and PHP-FPM 7.2)
#        https://localhost:9104 with SSL (with Nginx and PHP-FPM 7.3)
#        https://localhost:9105 with SSL (with Nginx and PHP-FPM 7.4)
#        https://localhost:9150 with SSL (with Nginx and PHP-FPM 5.6 with redis)
#        https://localhost:9151 with SSL (with Nginx and PHP-FPM 7.0 with redis)
#        https://localhost:9152 with SSL (with Nginx and PHP-FPM 7.1 with redis)
#        https://localhost:9153 with SSL (with Nginx and PHP-FPM 7.2 with redis)
#        https://localhost:9154 with SSL (with Nginx and PHP-FPM 7.3 with redis)
#        https://localhost:9155 with SSL (with Nginx and PHP-FPM 7.4 with redis)

#
#    On the main setup input screen:
#     1. for Server Host, use either 'mariadb' or 'mysql' or 'mysql-old' or 'mysql-very-old' or 'mariadb-old' or 'mariadb-very-old' or 'mariadb-very-very-old' (have both mariadb/mysql/mariadb-dev/mysql dockers ready to go make testing either one easy; mysql is version 8.0; mysql-old is version 5.7; mysql-very-old is version 5.6; mariadb is version 10.4; mariadb-old is version 10.3; mariadb-very-old is version 10.2; mariadb-very-very-old is version 10.1)
#     2. for Root Pass, use 'root'
#     3. for User Hostname, use '%'
#    And when need to tear it down and restart it
#     1. docker-compose down -v
#     2. docker-compose up -d
#    Can see databases via http://localhost:8200
#
version: '3.1'
services:
  openemr-7-1:
    restart: always
    image: openemr/openemr:flex-3.7
    ports:
    - 8080:80
    - 9080:443
    volumes:
    - ../../..:/var/www/localhost/htdocs/openemr
    environment:
      FORCE_NO_BUILD_MODE: "yes"
      EMPTY: "yes"
  openemr-7-2:
    restart: always
    image: openemr/openemr:flex-3.9
    ports:
    - 8081:80
    - 9081:443
    volumes:
    - ../../..:/var/www/localhost/htdocs/openemr
    environment:
      FORCE_NO_BUILD_MODE: "yes"
      EMPTY: "yes"
  openemr-7-3:
    restart: always
    image: openemr/openemr:flex-3.10
    ports:
    - 8082:80
    - 9082:443
    volumes:
    - ../../..:/var/www/localhost/htdocs/openemr
    environment:
      EMPTY: "yes"
  openemr-edge:
    restart: always
    image: openemr/openemr:flex-edge
    ports:
    - 8083:80
    - 9083:443
    volumes:
    - ../../..:/var/www/localhost/htdocs/openemr
    environment:
      FORCE_NO_BUILD_MODE: "yes"
      EMPTY: "yes"
  openemr-7-1-redis:
    restart: always
    image: openemr/openemr:flex-3.7
    ports:
    - 8084:80
    - 9084:443
    volumes:
    - ../../..:/var/www/localhost/htdocs/openemr
    environment:
      FORCE_NO_BUILD_MODE: "yes"
      REDIS_SERVER: "redis"
      EMPTY: "yes"
  openemr-7-2-redis:
    restart: always
    image: openemr/openemr:flex-3.9
    ports:
    - 8085:80
    - 9085:443
    volumes:
    - ../../..:/var/www/localhost/htdocs/openemr
    environment:
      FORCE_NO_BUILD_MODE: "yes"
      REDIS_SERVER: "redis"
      EMPTY: "yes"
  openemr-7-3-redis:
    restart: always
    image: openemr/openemr:flex-3.10
    ports:
    - 8086:80
    - 9086:443
    volumes:
    - ../../..:/var/www/localhost/htdocs/openemr
    environment:
      FORCE_NO_BUILD_MODE: "yes"
      REDIS_SERVER: "redis"
      EMPTY: "yes"
  openemr-edge-redis:
    restart: always
    image: openemr/openemr:flex-edge
    ports:
    - 8087:80
    - 9087:443
    volumes:
    - ../../..:/var/www/localhost/htdocs/openemr
    environment:
      FORCE_NO_BUILD_MODE: "yes"
      REDIS_SERVER: "redis"
      EMPTY: "yes"
  mariadb:
    restart: always
    image: mariadb:10.4
    command: ['mysqld','--character-set-server=utf8']
    ports:
    - 8210:3306
    environment:
      MYSQL_ROOT_PASSWORD: root
  mariadb-old:
    restart: always
    image: mariadb:10.3
    command: ['mysqld','--character-set-server=utf8']
    environment:
      MYSQL_ROOT_PASSWORD: root
  mariadb-very-old:
    restart: always
    image: mariadb:10.2
    command: ['mysqld','--character-set-server=utf8']
    environment:
      MYSQL_ROOT_PASSWORD: root
  mariadb-very-very-old:
    restart: always
    image: mariadb:10.1
    command: ['mysqld','--character-set-server=utf8']
    environment:
      MYSQL_ROOT_PASSWORD: root
  mysql:
    restart: always
    image: mysql:8
    command: ['mysqld','--character-set-server=utf8','--default-authentication-plugin=mysql_native_password']
    ports:
    - 8220:3306
    environment:
      MYSQL_ROOT_PASSWORD: root
  mysql-old:
    restart: always
    image: mysql:5.7
    command: ['mysqld','--character-set-server=utf8']
    environment:
      MYSQL_ROOT_PASSWORD: root
  mysql-very-old:
    restart: always
    image: mysql:5.6
    command: ['mysqld','--character-set-server=utf8']
    environment:
      MYSQL_ROOT_PASSWORD: root
  phpmyadmin:
    restart: always
    image: phpmyadmin/phpmyadmin
    ports:
    - 8200:80
    environment:
      PMA_HOSTS: mariadb,mariadb-old,mariadb-very-old,mariadb-very-very-old,mysql,mysql-old,mysql-very-old
  couchdb:
    restart: always
    image: couchdb
    ports:
    - 5984:5984
    - 6984:6984
    environment:
      COUCHDB_USER: admin
      COUCHDB_PASSWORD: password
  orthanc:
    restart: always
    image: jodogne/orthanc-plugins
    ports:
    - 4242:4242
    - 8042:8042
  nginx:
    restart: always
    image: openemr/dev-nginx
    ports:
    - 8100:80
    - 9100:440
    - 8101:81
    - 9101:441
    - 8102:82
    - 9102:442
    - 8103:83
    - 9103:443
    - 8104:84
    - 9104:444
    - 8105:85
    - 9105:445
    - 8150:90
    - 9150:450
    - 8151:91
    - 9151:451
    - 8152:92
    - 9152:452
    - 8153:93
    - 9153:453
    - 8154:94
    - 9154:454
    - 8155:95
    - 9155:455
    volumes:
    - ../../..:/usr/share/nginx/html/openemr
    - ./dockers/dev-nginx/nginx.conf:/etc/nginx/nginx.conf:ro
    - ./dockers/dev-nginx/dummy-cert:/etc/nginx/dummy-cert:ro
    - ./dockers/dev-nginx/dummy-key:/etc/nginx/dummy-key:ro
    depends_on:
    - dev-php-fpm-5-6
    - dev-php-fpm-7-0
    - dev-php-fpm-7-1
    - dev-php-fpm-7-2
    - dev-php-fpm-7-3
    - dev-php-fpm-5-6-redis
    - dev-php-fpm-7-0-redis
    - dev-php-fpm-7-1-redis
    - dev-php-fpm-7-2-redis
    - dev-php-fpm-7-3-redis
  dev-php-fpm-5-6:
    restart: always
    image: openemr/dev-php-fpm:5.6
    volumes:
    - ../../..:/usr/share/nginx/html/openemr
    - ./dockers/dev-php-fpm-5-6/php.ini:/usr/local/etc/php/php.ini:ro
  dev-php-fpm-7-0:
    restart: always
    image: openemr/dev-php-fpm:7.0
    volumes:
    - ../../..:/usr/share/nginx/html/openemr
    - ./dockers/dev-php-fpm-7-0/php.ini:/usr/local/etc/php/php.ini:ro
  dev-php-fpm-7-1:
    restart: always
    image: openemr/dev-php-fpm:7.1
    volumes:
    - ../../..:/usr/share/nginx/html/openemr
    - ./dockers/dev-php-fpm-7-1/php.ini:/usr/local/etc/php/php.ini:ro
  dev-php-fpm-7-2:
    restart: always
    image: openemr/dev-php-fpm:7.2
    volumes:
    - ../../..:/usr/share/nginx/html/openemr
    - ./dockers/dev-php-fpm-7-2/php.ini:/usr/local/etc/php/php.ini:ro
  dev-php-fpm-7-3:
    restart: always
    image: openemr/dev-php-fpm:7.3
    volumes:
    - ../../..:/usr/share/nginx/html/openemr
    - ./dockers/dev-php-fpm-7-3/php.ini:/usr/local/etc/php/php.ini:ro
  dev-php-fpm-7-4:
    restart: always
    image: openemr/dev-php-fpm:7.4
    volumes:
    - ../../..:/usr/share/nginx/html/openemr
    - ./dockers/dev-php-fpm-7-4/php.ini:/usr/local/etc/php/php.ini:ro
  dev-php-fpm-5-6-redis:
    restart: always
    image: openemr/dev-php-fpm:5.6-redis
    volumes:
    - ../../..:/usr/share/nginx/html/openemr
    - ./dockers/dev-php-fpm-5-6-redis/php.ini:/usr/local/etc/php/php.ini:ro
  dev-php-fpm-7-0-redis:
    restart: always
    image: openemr/dev-php-fpm:7.0-redis
    volumes:
    - ../../..:/usr/share/nginx/html/openemr
    - ./dockers/dev-php-fpm-7-0-redis/php.ini:/usr/local/etc/php/php.ini:ro
  dev-php-fpm-7-1-redis:
    restart: always
    image: openemr/dev-php-fpm:7.1-redis
    volumes:
    - ../../..:/usr/share/nginx/html/openemr
    - ./dockers/dev-php-fpm-7-1-redis/php.ini:/usr/local/etc/php/php.ini:ro
  dev-php-fpm-7-2-redis:
    restart: always
    image: openemr/dev-php-fpm:7.2-redis
    volumes:
    - ../../..:/usr/share/nginx/html/openemr
    - ./dockers/dev-php-fpm-7-2-redis/php.ini:/usr/local/etc/php/php.ini:ro
  dev-php-fpm-7-3-redis:
    restart: always
    image: openemr/dev-php-fpm:7.3-redis
    volumes:
    - ../../..:/usr/share/nginx/html/openemr
    - ./dockers/dev-php-fpm-7-3-redis/php.ini:/usr/local/etc/php/php.ini:ro
  redis:
    restart: always
    image: redis
  dev-php-fpm-7-4-redis:
    restart: always
    image: openemr/dev-php-fpm:7.4-redis
    volumes:
    - ../../..:/usr/share/nginx/html/openemr
    - ./dockers/dev-php-fpm-7-4-redis/php.ini:/usr/local/etc/php/php.ini:ro
  redis:
    restart: always
    image: redis
  openldap:
    restart: always
    image: osixia/openldap
