'How to configure heroku.yml having the docker-compose.yml

This is a very simple test app of two containers and can be deployed locally with docker-compose.yml and heroku doesn't support the docker-compose.yml file, in my opinion it does support it but partially that's why uses a file called heroku.yml instead.

I dont know how to configure ports in heroku.yml, and in the docker section; those names (web_server and web_client) are they dynos?, can I give them any name or just web and worker? and which would be which?

Any comment or suggestion please.

docker-compose.yml

version: "3"
services:
  api_server:
    image: api_server
    build: ./
    ports: 
      - 5000:5000
    networks: 
      - upload_app
  react_app:
    image: react_app
    build: ./client/
    ports:
      - 3000:3000
    networks: 
      - upload_app
networks:
  upload_app:
    driver: bridge

heroku.yml

build:
  docker:
    web_server: Dockerfile
    web_client: ./client/Dockerfile


Solution 1:[1]

Unfortunately there is no direct map between docker-compose (where you can deploy multiple applications) and heroku.yml (where you can define only one Web Dyno - hence one web application).

With heroku.yml you can deploy one application that includes one Web dyno and multiple workers, that's why you cannot define the ports. In Heroku you never define ports but it is typically the platform that provides you with the port you need via the $PORT env variable.

Here is my blog post explaining heroku.yml limitations and an alternative.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Beppe C