我正在try 将我的Flatter web项目归档.一张图片被创建出来,网站运行得很好,只是我的网站的图片没有找到,也没有显示出来,我不知道为什么.它给了我这个错误:

172.17.0.1 - - [12/May/2022 14:25:04] "GET / HTTP/1.1" 200 -

172.17.0.1 - - [12/May/2022 14:25:04] code 404, message File not found

172.17.0.1 - - [12/May/2022 14:25:04] "GET /packages/image_cropper_for_web/src/croppie/js/croppie.css HTTP/1.1" 404 -

172.17.0.1 - - [12/May/2022 14:25:05] code 404, message File not found

172.17.0.1 - - [12/May/2022 14:25:09] "GET /assets/photos/bgfinal.png HTTP/1.1" 404 -

172.17.0.1 - - [12/May/2022 14:25:09] code 404, message File not found

Dockerfile:

FROM ubuntu:20.04

RUN apt-get update
ARG DEBIAN_FRONTEND=noninteractive
RUN apt-get install -y curl git wget unzip libgconf-2-4 gdb libstdc++6 libglu1-mesa fonts-droid-fallback lib32stdc++6 python3
RUN apt-get clean

# download Flutter SDK from Flutter Github repo
RUN git clone https://github.com/flutter/flutter.git /usr/local/flutter

# Set flutter environment path
ENV PATH="/usr/local/flutter/bin:/usr/local/flutter/bin/cache/dart-sdk/bin:${PATH}"

# Run flutter doctor
RUN flutter doctor

# Enable flutter web
RUN flutter channel master
RUN flutter upgrade
RUN flutter config --enable-web

# Copy files to container and build
RUN mkdir /app/
COPY . /app/
WORKDIR /app/
RUN flutter build web

# Record the exposed port
EXPOSE 5000

# make server startup script executable and start the web server
RUN ["chmod", "+x", "/app/server/server.sh"]

ENTRYPOINT [ "/app/server/server.sh"]

这是服务器.sh文件:

#!/bin/bash

# Set the port
PORT=5000

# Stop any program currently running on the set port
echo 'preparing port' $PORT '...'
fuser -k 5000/tcp

# switch directories
cd build/web/

# Start the server
echo 'Server starting on port' $PORT '...'
python3 -m http.server $PORT

推荐答案

事情就是这样.我觉得他的代码有问题.正如我昨天试图用他的代码构建的那样,但事情并没有按应有的方式运行.我花了2个小时研究他的代码,其中50%用于构建图像,但从未完成.没问题,我try 过修改一些东西,我正在GitHub https://github.com/ash-0001/fludino.git上与您共享一些代码.继续学习和分享.Good Is Image.

The final image looks like this:

enter image description here

必须使用两个命令来初始化:

  1. docker build-t flut.
  2. docker run-i-p 808:4040-td flut

Flutter相关问答推荐

从Flutter应用程序解释蓝牙BLE数据:了解Sylvania压力值

无法将Flutter 连接到Firebase

在Android Studio的新用户界面中未找到热重新加载

如何实现Flutter 梳理机图像的小量移动

怎么才能像这样在摆动着这些曲线呢?

无法将新文物与Flutter 项目集成在一起

Flutter守护进程无法启动

为什么FloatingActionButton未显示

Flutter-Riverpod:如何只从提供者读取一次值

无法应用插件com.chaquo.python

在Flutter中为容器实现线性渐变背景动画

文本溢出文本框 - Flutter

flutter 在文本字段中更改部分文本选定 colored颜色

如何在两个不同的路由(屏幕)之间正确设置 BlocProvider?

如何从 showModalBottomSheet 中的 topRight 和 topLeft 移除平边

Pub get 尚未运行

从物理设备 Flutter 中移除 USB 后启动画面不可见?

Flutter Web Responsiveness 效率不高

Navigator.push '!_debugLocked' 上的错误:不正确

Flutter Desktop,如何获取windows用户配置文件名称?