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.

Step 1: Create a NiceGUI App

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

from nicegui import ui
from quotes import Quotes

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