Fly CLI in Dockerfile?

I have been trying to get fly installed on my Phoenix app’s machine, but my Docker skills are a bit rusty. The shell script appears to be installing since I can export the FLYCTL_INSTALL and PATH env vars can be exported manually in the remote shell.

▶ fly ssh console --pty
Connecting to YADAYADA... complete
root@YADA:/app# fly
-bash: fly: command not found
root@YADA:/app# export FLYCTL_INSTALL="/root/.fly"
root@YADA:/app# export PATH="$FLYCTL_INSTALL/bin:$PATH"
root@YADA:/app# fly
This is flyctl, the command line interface.

  fly [flags]
  flyctl [command]

Here’s the relevant Dockerfile code:

The reason for installing the CLI is to list the Fly regions since there doesn’t appear to be a public API for this. This will allow me to perform ad-hoc latency measurements using a variety of protocols.

Needless to say, it works on my local machine :clown_face:.

Try this:

FROM flyio/flyctl:latest as flyio
FROM ${BUILDER_IMAGE} as builder

. . .

COPY --from=flyio /flyctl /usr/bin

Note: that will create an executable named flyctl. If you want fly, create a symbolic link.

1 Like

That worked! Thank you, @rubys !