How do you serve you flutter web app from a docker container?

I have looked at creating a simple golang application serving static files and looked at dart server.

Also looked at nginx, but it has problems running on k8s(Readiness probe failed)


Solution 1: Dancheg97

Yes, you can drop a single .go file to start hosting your application (after flutter build web):

package main

import (
    "log"
    "net/http"
)

func main() {
    fs := http.FileServer(http.Dir("build/web/"))
    http.Handle("/", fs)
    log.Println("Listening on :8080...")
    err := http.ListenAndServe(":8080", nil)
    if err != nil {
        log.Fatal(err)
    }
}

than you can access that on http://localhost:8080/#/