I am new to github actions, I am trying to build an docker image with an artifact from maven repo. The process works fine until the COPY stage, I received the following error:
#6 [2/3] COPY /tmp/eb47ef3d-5bd0-4ad9-a975-fe90395c5477/norconex-collector-http-3.0.2.zip /nxer #6 ERROR: failed to calculate checksum of ref 1fc30fa1-1c27-471d-88c5-f9ef7be1c990::2dvvtji2m8thd1cu1if5dg2w1: failed to walk /var/lib/docker/tmp/buildkit-mount2321225556/tmp/eb47ef3d-5bd0-4ad9-a975-fe90395c5477: lstat /var/lib/docker/tmp/buildkit-mount2321225556/tmp/eb47ef3d-5bd0-4ad9-a975-fe90395c5477: no such file or directory
This is what my Dockerfile looks like:
From ubuntu:22.04
ARG DL_FILE
COPY $DL_FILE /nxer
The $DL_FILE variable gets its value from the docker build command, which refer to the location of the downloaded artifact.
In my github actions workflow:
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Download Maven Artifact
id: download-maven-artifact
uses: clausnz/github-action-download-maven-artifact@master
with:
url: 'https://repo1.maven.org'
repository: 'maven2'
groupId: 'com.norconex.collectors'
artifactId: 'norconex-collector-http'
version: '3.0.2'
extension: 'zip'
- name: Output file path in container
run: |
echo "File has been downloaded to ${{ steps.download-maven-artifact.outputs.file }}"
- name: Build the Docker image
uses: docker/build-push-action@v4
with:
context: .
push: false
build-args: DL_FILE=${{ steps.download-maven-artifact.outputs.file }}
I googled it and it looks like the issue is the downloaded artifact is saved outside of the docker context, so when I copy it, the file is not found.
I tried things like adding flag like: context, build-context, but it doesn't seem to work.
Is there a way to work around the issue? Thanks
Brian
Tried adding different flag to docker build command