Closed Dokotela closed 3 years ago
Turns out I'm just an idiot and was trying to serve the website from the same directory on my computer as in my docker container (suprise! that didn't work). I've changed my server.dart
file to be:
import 'package:get_server/get_server.dart'; void main() => runApp(GetServer(home: FolderWidget('./app/web')));
And my docker file is now:
################
FROM google/dart:2.10
WORKDIR /app
COPY pubspec.yaml /app/pubspec.yaml
RUN dart pub get
COPY . .
RUN dart pub get --offline
RUN dart compile exe bin/server.dart -o bin/server
########################
FROM subfuzion/dart:slim
COPY --from=0 /app/bin/server /app/bin/server
COPY --from=0 /app/web /app/web
EXPOSE 8080
ENTRYPOINT ["/app/bin/server"]
And it works like a charm.
Thanks so much for this docker image! I've been using it successfully to run a server, and now I wanted to use it to host a Flutter Web App. My folder structure looks like this:
The web folder is just the simple Flutter demo app with floating button and counter. My server.dart looks like this:
And my docker file looks like this:
I can run the server directly from the command line as:
$ dart server.dart
And that runs perfectly. However, if I build and run the docker container, it will run, when I go to0.0.0.0:8080
orlocalhost:8080
it just says the page can't be found.Any idea what I'm doing wrong? Thanks!