Self-hosting your SaaS app as a docker image allows you to have complete control over your server environment. It ensures better privacy, contributes to cost savings if managed correctly, and offers you the flexibility to customize your server setup to suit your specific needs. It can also give your application a performance boost compared to hosting on a serverless platform like Vercel, since it removes cold starts.
Make sure you have an account on Fly.io before continuing. You can sign up for free at fly.io.To deploy your application with Docker to fly.io simply install the Fly CLI and run the following command from your project’s root:
Terminal
Copy
fly launch --dockerfile apps/web/Dockerfile
fly launch —dockerfile apps/web/Dockerfile
Follow the steps in the CLI and configure the used port to 3000 in the deployment configuration and you should have a running instance of your app within a few minutes on fly.io.