使用Docker运行Flutter Web。找不到命令抖动

时间:2020-11-05 16:28:37

标签: docker flutter docker-compose flutter-web

我试图在docker上运行Flutter网站,但是当我运行docker-compose up时遇到此错误

dashboard_1 | /docker-entrypoint.sh:38:exec:flutter:找不到

Dockerfile

FROM cirrusci/flutter AS build

RUN flutter channel beta
RUN flutter upgrade
RUN flutter config --enable-web

RUN mkdir /app/
COPY . /app/
WORKDIR /app/
RUN flutter build web
FROM nginx
COPY --from=build /app/build/web /usr/share/nginx/html

docker-compose.yml

version: '3.1'
services:
    dashboard:
        build: .
        restart: always
        ports:
            - "8080:8080"
        command: ["flutter", "pub", "get", "&&", "flutter", "run", "-d", "chrome"]

1 个答案:

答案 0 :(得分:0)

您最后一张图片是nginx,其中不包含抖动内容。

只需删除这些行

FROM nginx
COPY --from=build /app/build/web /usr/share/nginx/html

并安装nginx发行版,如果您想进一步在flutter中使用它。

RUN apt update && apt install -y nginx

我还建议将此行放在FROM cirrusci/flutter AS build语句之后。