Unable to create docker image using github action

65 Views Asked by At

I am using github action to create bw6 application and docker image out of the jar file. Github action pulling code from github and create a jar file , below is the github action workflow:

name: Tibco Workflow

on:
  workflow_dispatch:  # Allows manual triggering of the workflow

jobs:
  build:
    runs-on: ubuntu-latest

    steps:
    - name: Checkout Repository
      uses: actions/checkout@v2

    - name: Set up JDK and Maven
      uses: actions/setup-java@v2
      with:
        distribution: 'adopt'
        java-version: '11'
        
    - name: Print Current Directory
      run : ls -la /home/runner/work/sm.baseSchema/sm.baseSchema/src/sm.baseSchemas/target
       

    - name: Build and Package BW6 Application
      run: |
        cd src/sm.baseSchemas
        mvn clean package -P mavenize
      env:
        MAVEN_OPTS: '-Dmaven.repo.local=./.m2/repository'
        

    -  name: Set up QEMU
       uses: docker/setup-qemu-action@v3
      
    -  name: Set up Docker Buildx
       uses: docker/setup-buildx-action@v3
      
    -  name: Login to Docker Hub
       uses: docker/login-action@v3
       with:
          username: USERNAME
          password: PASSWORD

    - name: Build and push images
      run : | 
          docker build -t smbase:smbase -f /home/runner/work/sm.baseSchema/sm.baseSchema/src/sm.baseSchemas/target/Dockerfile .
    

but while running the workflow getting error in the stage : "Build and push images"

ERROR: failed to solve: failed to read dockerfile: open /var/lib/docker/tmp/buildkit-mount1297911053/Dockerfile: no such file or directory Error: Process completed with exit code 1.

My docker file is like below:

FROM tibco/bwce:latest

WORKDIR /app

COPY /home/runner/work/sm.baseSchema/sm.baseSchema/src/sm.baseSchemas/target/sm.baseSchemas_1.0.0.202303271123.jar /app/

EXPOSE 8080

CMD ["java", "-jar", "sm.baseSchemas_1.0.0.202303271123.jar"] 


[![enter image description here][1]][1]
1

There are 1 best solutions below

2
Bhikesh Khute On

GitHub actions is unable to recognise your "Dockefile" because it might have some extension behind it. Remember to put the filetype as "File" only. Then it will be recognised. Try notepad++ if any issues.