1 year ago

#360971

test-img

Scoopex

Github Action Maven CI/CD to Docker Hub

I want to implement CI/CD to a Basic Java Maven project with Github Action and deployment to Docker HUB.. i set up everything and followed this tutorial

here is my main.yml file: (without the build)

  publish-job:
      runs-on: ubuntu-latest
      needs: [build_and_test]
      steps:
        - uses: actions/checkout@v2
        - uses: actions/setup-java@v1
          with:
            java-version: 17
        - run: mvn -B package --file pom.xml -DskipTests
        - run: mkdir staging && cp target/*jar-with-dependencies.jar staging
        - uses: actions/upload-artifact@v1
          with:
            name: Package
            path: staging
  
  build-docker-image:
    name: Publish to Docker Hub
    runs-on: ubuntu-latest
    needs: [build_and_test]

    steps:
      - uses: actions/checkout@v2
      - name: Login to Docker Hub
        run: docker login -u ${{ secrets.DOCKER_USERNAME }} -p ${{ secrets.DOCKER_PASSWORD }}
      - name: Build Container image
        run: docker build -t ${{ secrets.DOCKER_REPO }}:latest .
      - name: Publish Docker image
        run: docker push ${{ secrets.DOCKER_REPO }}

getting this error:

enter image description here

The Build is successful, but something seems wrong with the publish job

docker

maven

continuous-integration

github-actions

continuous-deployment

0 Answers

Your Answer

Accepted video resources