Deploying user-code with fly machines API - how to create docker images?

Hi there, I’m currently working on a feature that requires running user code and it looks like fly.io would be a good fit for this with the machine API. The issue I’m running into at the moment is how do I actually build and push a docker image for the user code I want to run on fly machines? Here’s my dilemma:

  • I have this code shipping from the user’s machine to my server via our CLI.
  • Our server is running itself as a docker container
  • I don’t really want to A. run docker in our server docker container or B. run a separate server that has access to a docker daemon (i.e. on a EC2 instance or something)
  • I could build the docker image on the user’s machine instead of pushing the code to my server, but how do I push it to the fly registry without exposing my fly access token to the user’s machine?

BTW this is for the following feature in Trigger.dev: Background Tasks v1 · triggerdotdev/trigger.dev · Discussion #400 · GitHub

What I’ve done is create an app/machine in Fly that has Docker in it. This is CLOSE to what you say you want to avoid (running Docker in ec2 or something), but perhaps bc it’s within the Fly private network, it would be acceptable? (I’m not sure what constraints you’re running within!)

I’ve created me own app/machine that has itself Docker in Fly, and connect to it via wireguard VPN provides

Here’s the repository with an “in-production” example that is in use to help build our Laravel images for the fly launch command: https://github.com/fly-apps/laravel-docker/tree/main/fly-builder

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