Skip to content
Rodja Trappe edited this page Sep 4, 2023 · 15 revisions

Deploying a NiceGUI App on Fly.io

This tutorial demonstrates how to deploy a NiceGUI application on Fly.io. We assume familiarity with Python, FastAPI, and basic networking.

Steps

Step 1: Create a NiceGUI App

Create a Python file main.py with the following content:

from nicegui import ui

quotes = Quotes()
ui.button('Quote', on_click=lambda: ui.notify(quotes.random()[1]))

ui.run()

Step 2: Dockerize App

Create a Dockerfile which describes the setup of packages you need to run your app:

FROM zauberzeug/nicegui:1.3.13

RUN pip install quotes

COPY . /app

Step 3: Setup and Launch

  1. Install flyctl, the command line interface (CLI) to administer your fly.io deployment.
  2. Create an account with the terminal command fly auth signup or login with fly auth login.
  3. Run fly launch from inside your project source directory, it will create, configure, and deploy your new application according to the Dockerfile.
Clone this wiki locally