I have a fairly simple SvelteKit + Vapor + PostgreSQL app. I’d hoped that Fly’s recent addition of support for Compose would let me create a nice one-stop deploy for the whole app, building and deploying both the front and back end with a single fly deploy:
- nginx in one container
- …serving compiled static assets for front end
- …and proxying
/api/*to a second container that has the back end.
(This topology is fine for my little app; I expect usage is never going to be such that I’ll need to scale up either the front or the back end.)
Alas, when I enable [build.compose]in my fly.tomland try to deploy that, Fly informs me that:
only one service can specify build
Drat! This is a surprising and disappointing limitation. Am I just out of luck doing this one-stop deploy with Fly?
Here’s the relevant portion of my compose.ymlfile, in case it’s illuminating:
services:
web-server:
build:
context: .
target: web-server
depends_on:
- api-server
ports:
- '80:80'
api-server:
build:
context: .
target: api-server
environment:
<<: *server_environment
depends_on:
- db
ports:
- '8080:8080'
db:
image: postgres:16-alpine
volumes:
- db_data:/var/lib/postgresql/data/pgdata
environment:
PGDATA: /var/lib/postgresql/data/pgdata
POSTGRES_USER: vapor_username
POSTGRES_PASSWORD: vapor_password
POSTGRES_DB: vapor_database
ports:
- '5432:5432'
AFAICT, my options here are:
- Don’t use compose with Fly, and instead deploy the front and back end as completely separate Fly apps.
- Make Vapor serve the static assets itself.
- Deploy the static assets completely separately, on Netlify or something.
Is there some tidier way to do this? Want to deploy both the front and the back end of a web app in one fell swoop seems like it must be a fairly common wish, and I feel like I must be missing something.

.)