Failed to fetch image or buildpack when deploying Laravel App

Using the latest fly deploy laravel guide, it says all you need to do is fly launch and then fly deploy --remote-only. However, when deploying I get the below error.

Error failed to fetch an image or build from source: app does not have a Dockerfile or buildpacks configured. See https://fly.io/docs/reference/configuration/#the-build-section

Is the .toml file suppose to have some [build] section auto setup? Mine doesn’t. Actually, looking at the fly-laravel .toml, it doesn’t either

# fly.toml file generated for fly-laravel-app on 2022-10-16T10:05:30+09:30

app = "fly-laravel-app"

kill_signal = "SIGINT"
kill_timeout = 5
processes = []

[env]
  # Bunch of Laravel env values, including db stuff, omitted... 

[experimental]
  allowed_public_ports = []
  auto_rollback = true

[deploy]
  release_command = "php /var/www/html/artisan migrate --force"

[[services]]
  http_checks = []
  internal_port = 8080
  processes = ["app"]
  protocol = "tcp"
  script_checks = []

  [services.concurrency]
    hard_limit = 25
    soft_limit = 20
    type = "connections"

  [[services.ports]]
    force_https = true
    handlers = ["http"]
    port = 80

  [[services.ports]]
    handlers = ["tls", "http"]
    port = 443

  [[services.tcp_checks]]
    grace_period = "1s"
    interval = "15s"
    restart_limit = 0
    timeout = "2s"

The only thing I added was the env values, and deployment comment, everything else is default fly launch presets.

Versions

flyctl v0.0.325 linux/amd64 Commit: da2b638 BuildDate: 2022-04-28T04:26:35Z

Edit: Found Docker files from fly laravel example github

Looking at the Fly Laravel Github Example, they have a bunch of docker files, which I assume fly launch was supposed to add from the Laravel guide wording.

Just tried to add them and getting build error on step 12

Step 11/36 : RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
 ---> Running in f89e31f84cc3
/bin/sh: php: not found
curl: (23) Failure writing output to destination
Error failed to fetch an image or build from source: error building: error rendering build status stream: The command '/bin/sh -c curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer' returned a non-zero code: 127

So, someone else got the same error with the Laravel github example, but that github is significantly older than the current flyctl laravel commands. Hence the exampel github is non-functional and everything relies on the fly launch laravel detection stuff.

Fly Laravel deployment really just isn’t as abc as the guide makes out…

Edit: Potentially a flyctl version issue?

I wonder if this is just a local flyctl error, fly version gives 0.0.325, but when doing brew upgade flyctl, it gives Warning: flyctl 0.0.412 already installed. Hmm?

Turns out I was using an older version of fly. But my system had 2 flys installed.

Updated to latest fly, 0.0.412 and it works fine now.

1 Like