Problems with Github Actions for CD Path

Hi. So I have a Github Repo where I have a client and api directory in the root of the project. I First deployed the API directory to FLY using the FLY CLI, hence the fly.toml and the Dockerfile were created inside the API folder.

I’m now trying to create a GitHub Action workflow for CD, but I’m getting errors mainly because of the path. At first I was getting an error that the config file didn’t have an APP Name.
‘Error: the config for your app is missing an app name, add an app field to the fly.toml file or specify with the -a flag’

I fixed this error by providing the correct path to the fly.toml file in the workflow.


jobs:
  deploy:
    name: Deploy app
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
      - uses: superfly/flyctl-actions/setup-flyctl@master
      - run: flyctl deploy --config ./api/fly.toml --remote-only
        env:
          FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }}

But now I’m getting the following error message:

Error: failed to fetch an image or build from source: app does not have a Dockerfile or buildpacks configured. See Fly Launch configuration (fly.toml) · Fly Docs

Is there a way to configure the API path in the workflow file so that it looks in there for all the files needed?

Any help would be greatly appreciated.

hi @cacososa

try adding --dockerfile ./api/Dockerfile as another option to the fly deploy command.

fly deploy looks for the Dockerfile in the working directory too.

1 Like

Hi @andie . Thanks for the suggestion. I found that shortly after posting the question, however I then got another error related to the package.json file which couldn’t be found. What ended up working was adding a cd ./api to the run command… :rofl: pretty obvious

run: cd ./api && flyctl deploy --remote-only

Thanks for the quick reply.

ha ha that works much better than adding more flags to the deploy command!

glad you got it working!

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.