I'm very new to Docker and I'm trying to get my Github repository setup with a docker when I push an update. However, when the github workfile script goes to push my code to Docker I get the following error.
Error: buildx failed with: error: failed to solve: failed to compute cache key: failed to walk /var/lib/docker/tmp/buildkit-mount1164878607/target: lstat /var/lib/docker/tmp/buildkit-mount1164878607/target: no such file or directory
It appears Docker can't access the file I set for it in my Dockerfile yet no amount of tweaking with the code appears to fix it, aside for me completely removing the COPY tag which renders my Docker unrunnable, though it does send. I'm using maven compiler plugin along with maven shade plugin and have setup my pom.xml file accordingly.
Here is my Github WorkFile:
name: Docker
on: [push]
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Set up JDK
uses: actions/setup-java@v3.3.0
with:
java-version: 18
distribution: adopt
- name: Build with Maven
run: mvn clean package
- name: Login to DockerHub
uses: docker/login-action@v2.0.0
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_TOKEN }}
- name: Build and push Docker images
uses: docker/build-push-action@v3.0.0
with:
push: true
tags: sudden/discordbot:latest
Here is my DockerFile:
FROM openjdk:11-jdk-slim
WORKDIR /tmp
COPY target/discordbot-1.0-SNAPSHOT-shaded.jar app.jar
EXPOSE 8080
ENTRYPOINT ["java","-jar","/app.jar"]
What I've tried:
- Copying another random file in my "src" directory.
- Changing the name of my jar file and changing the path.
- Changing my WORKDIR.
- Changed the Docker's "context" and other tags in my Workfile.
Any help is appreciated. This might be a simple fix, but I've been stuck on it for a day despite my best efforts so asking here is a last resort. Thanks.