Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Github Actions: unable to prepare context: unable to evaluate symlinks in Dockerfile path: lstat

So I've created a GitHub action that is supposed to build and push a docker image to docker hub whenever a push occurs. So here is my GitHub action: (first time creating a GitHub action)

name: Some name

on:
  push:

jobs:
  build_frontend:
    runs-on: ubuntu-latest

    steps:
      - name: Build frontend image
        run: docker image build -t image .

      - name: Push frontend image
        uses: elgohr/[email protected]
        with:
          name: image
          username: ${{ secrets.DOCKER_USERNAME }}
          password: ${{ secrets.DOCKER_TOKEN }}

But I get this error every time this runs:

unable to prepare context: unable to evaluate symlinks in Dockerfile path: lstat /home/runner/work/project/project/Dockerfile: no such file or directory [error]Process completed with exit code 1.

I tried fiddling around with the path, but then I only get no such file or directory. So this is the closest I am to something working.

Thanks for any help

like image 910
ANicholasson Avatar asked Dec 10 '22 00:12

ANicholasson


1 Answers

I believe you need to use the checkout action. Your repository isn't actually available to you until you do that:

So, before "Build frontend image":

  - name: Check out code
    uses: actions/checkout@v2

Since your Dockerfile is in your root, that should do it.

like image 89
Masa Avatar answered Apr 24 '23 23:04

Masa