Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error when trying to build a docker image with self-hosted github runner #24

Open
DirkWolthuis opened this issue Jul 31, 2020 · 5 comments

Comments

@DirkWolthuis
Copy link

When using the config bellow to try and build a docker image I get an error that the Dockerfile can't be found. Be when running the same script in a Github runner from Github it runs. I've mounted the volume to the container of the self-hosted Github runner:

The error message: unable to prepare context: unable to evaluate symlinks in Dockerfile path: lstat /github/workspace/Dockerfile: no such file or directory

jobs:
  # This workflow contains a single job called "build"
  build-and-publish-head:
    runs-on: ubuntu-16.04 #self-hosted does not work here. 

    steps:
      - uses: actions/checkout@v2 # Checking out the repo

      - name: Build and Publish head Docker image
        uses: VaultVulp/[email protected]
        with:
          github-token: ${{ secrets.GITHUB_TOKEN }} # Provide GITHUB_TOKEN to login into the GitHub Packages
          image-name: fantasy-map-tool-react # Provide Docker image name
          image-tag: ${{ github.sha }} # Provide Docker image tag

Any thoughts?

@DirkWolthuis DirkWolthuis changed the title Weird error message when trying to build a docker image Error when trying to build a docker image with self-hosted github runner Jul 31, 2020
@tcardonne
Copy link
Owner

Hello,

The error you're getting indicates that a Dockerfile can't be found. Could you double check the location of the Dockerfile in your repository ?

Also, I'm not sure, but it seems that VaultVulp/gp-docker-action is using a Docker based action, meaning that it will spin-up a container to run the build and push commands. However, as you are already running the runner inside Docker, this might also be an issue.

@DirkWolthuis
Copy link
Author

DirkWolthuis commented Aug 3, 2020

Hi! I think there is no problem with the dockerfile. It is in the root and works with Githubs own runner.

Domyou Guys use this project to build docker images? Do you have a action that works with this project?

PS. I got the same error message with the official docker action.

@tcardonne
Copy link
Owner

Hello,

Although it runs on shared runners and not self-hosted runners, the following docker-build job should work with this project : https://github.com/tcardonne/restic-controller/blob/master/.github/workflows/main.yml#L27

I can't investigate further your issue at the moment, but I'm almost sure that it's because the gp-docker-action is an action spinning up a new Docker image.

@alvarogarciafer
Copy link

Hi.

I experienced a similar issue with another action.

What's happening is that your repo is checked out inside the github-runner container, and your action is starting a different container where the repo and Dockerfile don't exist.

In my case, my action was looking for a file in -v "/home/runner/_work/my-repo/my-repo":"/github/workspace", so I simply ran the github-runner container with --mount type=bind,source=/home/runner/_work/,destination=/home/runner/_work/ so that the host directory /home/runner/_work/ acts as a common volume where the repo exists for both containers.

Hope it's the right solution and it helps

@michael-robbins
Copy link

michael-robbins commented Jan 11, 2021

Is there a way to avoid using the Host OS you think? Possibly with volumes?

I guess we can't control how the runner's logic about mounting containers works though?

Context: I'd like to have multiple runners on the same box, but they all can't share /home/runner/_work/?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants