konveyor / move2kube

Move2Kube is a command-line tool for automating creation of Infrastructure as code (IaC) artifacts. It has inbuilt support for creating IaC artifacts for replatforming to Kubernetes/Openshift.
https://move2kube.konveyor.io/
Apache License 2.0
385 stars 118 forks source link

Unable to find ports in Dockerfile warning message during transform #583

Closed Akash-Nayak closed 3 years ago

Akash-Nayak commented 3 years ago

Describe the bug The DockerfileParser is unable to parse the Dockerfile after updating to Go v1.17 and gives the warning mentioned below.

INFO[0021] Transformer DockerfileParser processing 1 artifacts 
WARN[0021] Unable to find ports in Dockerfile : /var/folders/sw/_kjrz98j3ws1qj7zz6chzhrr0000gn/T/move2kube906097344/environment-DockerfileParser-051817804/794098492/source/Dockerfile. Using default port 

The generated Dockerfile contains the port detected by Move2Kube, but same port is not there in the deployment yamls.

To Reproduce Steps to reproduce the behavior:

  1. Run move2kube transform on a sample application (like, PHP or NodeJs).

Expected behavior The DockerfileParser should parse the Dockerfile correctly.

Screenshots

Screenshot 2021-08-24 at 9 22 06 AM
ashokponkumar commented 3 years ago

Can you also share the generated dockerfile

Akash-Nayak commented 3 years ago

This is the generated Dockerfile

#
#   Licensed under the Apache License, Version 2.0 (the "License");
#   you may not use this file except in compliance with the License.
#   You may obtain a copy of the License at
#
#        http://www.apache.org/licenses/LICENSE-2.0
#
#   Unless required by applicable law or agreed to in writing, software
#   distributed under the License is distributed on an "AS IS" BASIS,
#   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
#   See the License for the specific language governing permissions and
#   limitations under the License.

FROM registry.access.redhat.com/ubi8/nodejs-12
COPY . .
RUN npm install
EXPOSE 8085
CMD npm run start

And this is the generated ingress yaml

apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  creationTimestamp: null
  labels:
    move2kube.konveyor.io/service: myproject4
  name: myproject4
spec:
  rules:
    - host: myproject4.com
      http:
        paths:
          - backend:
              service:
                name: main
                port:
                  name: port-8080
            path: /main
            pathType: Prefix
status:
  loadBalancer: {}