Issue
I am trying to docker the flutter example app, using the following:
flutter build web
Dockerfile:
FROM nginx:1.21.1-alpine
COPY ./web /usr/share/nginx/html
But it just shows a blank page – it runs fine with flutter run
, do you know how to run flutter web for production in container/Dockerfile?
Solution
You need to copy ./build/web
after building. The web
folder contains an empty index.html
, and used for adding JS dependancies..etc. The actual compiled folder should be inside build/web
/.
Answered By – Huthaifa Muayyad
Answer Checked By – Marie Seifert (FlutterFixes Admin)