1

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)

1 Answer 1

1

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/#/

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.