So i have dockerized spring boot application, i have docker file:
FROM openjdk:17
ADD target/KIII_Project_Final-0.0.1-SNAPSHOT.jar KIII_Project_Final-0.0.1-SNAPSHOT.jar
EXPOSE 8080
ENTRYPOINT ["java", "-jar", "KIII_Project_Final-0.0.1-SNAPSHOT.jar"]
And my github action is :
name: Build & Deploy
on:
push:
branches: [ master ]
workflow_dispatch:
jobs:
build_and_push:
name: Build & Push to DockerHub
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Login to DockerHub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}
- name: Docker Build and Push to DockerHub
uses: docker/build-push-action@v3
with:
context: .
push: true
tags: markoblazhevski/kiii:latest
and i get this error : Error: buildx failed with: ERROR: failed to solve: failed to compute cache key: failed to walk /var/lib/docker/tmp/buildkit-mount183090869/target: lstat /var/lib/docker/tmp/buildkit-mount183090869/target: no such file or directory
my github repository looks like this: IMAGE LINK I need help guys
I tried changing the action but it seems somehow the target folder cant be found , and i cant upload it and i dont know what to do, do i need to add something to my application or do i need to build it ? I am new to this so please help.
CodePudding user response:
There can be two solutions:
After docker login you can build and push by simple docker command
- name: Docker Build and Push to DockerHub run: | docker build -t markoblazhevski/kiii:latest . docker push markoblazhevski/kiii:latest
Other way is if you want to use this action then you need to setup buildx first before the build and push step. You can follow the documentation here.