services:
  app:
    build:
      args:
        user: harsoftng
        uid: 1000
      context: ./
      dockerfile: Dockerfile
    image: state-employment
    container_name: state-employment-app
    restart: unless-stopped
    working_dir: /var/www/
    depends_on:
      - state-db
    volumes:
      - ./:/var/www
      - ./docker/php.ini:/usr/local/etc/php/conf.d/php.ini
    networks:
      - state_employment_network
      - default

  state-db:
    image: mysql:8.0
    container_name: state-db
    environment:
      MYSQL_ALLOW_EMPTY_PASSWORD: true
      MYSQL_DATABASE: app_db
      MYSQL_USER: db_user
      MYSQL_PASSWORD: db_user_pass
      PATH: /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
      GOSU_VERSION: 1.14
      MYSQL_MAJOR: 8.0
      MYSQL_VERSION: 8.0.31-1.el8
      MYSQL_SHELL_VERSION: 8.0.31-1.el8
    ports:
      - "6033:3306"
    volumes:
      - dbdata:/var/lib/mysql
    networks:
      - state_employment_network
      - default

  phpmyadmin:
    image: phpmyadmin/phpmyadmin
    container_name: state-phpmyadmin
    links:
      - state-db
    environment:
      PMA_HOST: state-db
      PMA_PORT: 3306
#      PMA_ARBITRARY: 1
    restart: always
    depends_on:
      - state-db
    ports:
      - 8090:80
    networks:
      - state_employment_network
      - default

  nginx:
    image: nginx:alpine
    container_name: state-employment-nginx
    restart: unless-stopped
    ports: [ '8011:80', '8012:443' ]
    volumes:
      - ./:/var/www
      - ./docker/nginx/default.conf:/etc/nginx/conf.d/default.conf
      - ./docker/certificates/acd-certificate.crt:/cert/server.crt
      - ./docker/certificates/acd-certificate.key:/cert/server.key
    networks:
      default:
        aliases:
          - api.stateempowerment.devl
      state_employment_network:
        aliases:
          - api.stateempowerment.devl
    depends_on:
      - app

networks:
  default:
    driver: bridge
  state_employment_network:
    name: state_employment_network

volumes:
  dbdata:
