How to use superfly/flyctl-actions with yarn environment

Is there a way to use superfly/flyctl-actions when deploying from github while using both yarn during development and during deployment?

Error COPY failed: file not found in build context or excluded by .dockerignore: stat package-lock.json: file does not exist

Can you post your action here? And possibly your dockerfile? It looks like your dockerfile is trying to copy package-lock.json into the build.

This was for a project using the fly node builtin, so no Dockerfile.

Would love an example for a node typescript deploy. I believe we were also having issues with tsc compiling to /dist but /dist being gitignored causing it to not include the dist/ when deploying. I believe I had this issue in the past and ended up removing /dist from gitignore to get it to finally deploy correctly but prefer to not have to do this.

app = "my-app"

[experimental]
  private_network=true

[build]
  builtin = "node"

kill_signal = "SIGINT"
kill_timeout = 5

    
name: Fly Deploy
on: [push]
env:
  FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }}
jobs:
  build-deploy:
    name: Build & Deploy app to fly.io
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - uses: actions/setup-node@v1
        with:
          node-version: '12.x'
      - run: yarn install
      - run: yarn compile
      - uses: superfly/flyctl-actions@1.1
        with:
          args: "deploy"

Looks like the builtin doesn’t support yarn. Could you try using buildpacks instead by replacing the [build] section with this:

[build]
  builder = "paketobuildpacks/builder:base"
  buildpacks = ["gcr.io/paketo-buildpacks/nodejs"]
1 Like

This worked perfectly! Thank you @michael - my only feedback is these builders take a while to get setup haha. Must have pulled in 100+ images.

Yeah buildpacks do a lot of magic with layers to optimize build cache and final image size. Subsequent builds should be heavily cached though.

1 Like

@michael any insights on the gitignore issues we have seen in the past? Can I add dist back to the gitignore now?

You should be able to remove it from gitignore. Remote builders are just a docker daemon now so we only use dockerignore to filter what goes into the build context.

1 Like

Confirmed, thanks so much for your help @michael

1 Like