ballerina-platform / module-ballerina-c2c

Ballerina Code2Cloud implementation

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Unable to retrieve the port when listener is separately declared

anupama-pathirage opened this issue · comments

Description:

When the http:Listner is declared separately the port is not taken.

Steps to reproduce:

  1. Create a project with following sample code.
import ballerina/http;

listener http:Listener httpLis = new http:Listener(9090);

service / on httpLis {
    // This function responds with `string` value `Hello, World!` to HTTP GET requests.
    resource function get greeting() returns string {
        return "Hello, World!";
    }
}
  1. Run the following command

bal build --cloud=docker

  1. You can see the warning WARNING [main.bal:(6:14,6:21)] failed to retrieve port in the console and the generated Dockerfile doesn't contain the port.
Compiling source
        anupama/dockertest:0.1.0
WARNING [main.bal:(6:14,6:21)] failed to retrieve port

Generating executable

Generating artifacts...

        @kubernetes:Docker                       - complete 2/2 

        Execute the below command to run the generated Docker image: 
        docker run -d dockertest:latest

        target/bin/dockertest.jar

Affected Versions:

OS, DB, other environment details and versions:

Related Issues (optional):

Suggested Labels (optional):

Suggested Assignees (optional):