Skip to content

Dockerize web-based Flet Application #625

@pangoro24

Description

@pangoro24

I am not a really expert on docker but following the https://flet.dev/docs/guides/python/deploying-web-app/fly-io, I wanted to try my demo in my own computer. When I run the app from my local virtual env, the web app is displayed without problem. However, when I try to run it from a docker container, even when the container is running without issues, it give me error: (failed)net::ERR_EMPTY_RESPONSE

Docker commands used to create the image and run the container
docker build --tag flet-app:latest .
docker run -it -p 62590:62590 -p 8080:8080 flet-app

Source Code

import flet as ft

def main(page: ft.Page):
    page.add(ft.Text(value="Hello world from containerized Flet app!"))

ft.app(target=main, view=ft.WEB_BROWSER)

dockerfile

# syntax=docker/dockerfile:1

FROM python:3.8-slim-buster

WORKDIR /app

COPY requirements.txt requirements.txt
RUN pip3 install -r requirements.txt

COPY . . 

EXPOSE 8080 62590

CMD ["python", "./app/main.py"] 

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions