dimanche 1 septembre 2019

Docker - Flutter Web deployment - Site cannot be reached

I'm using Docker and Flutter Web. I just finished setting up Docker and Compose for it. My Dockerfile

FROM ubuntu:18.04

ARG PROJECT_DIR=/srv/api
ENV PATH=/opt/flutter/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin

RUN apt-get update && \
    apt-get install -y \
        xz-utils \
        git \
        openssh-client \
        curl && \
    apt-get upgrade -y && \
    rm -rf /var/cache/apt

RUN curl -L https://storage.googleapis.com/flutter_infra/releases/stable/linux/flutter_linux_v1.7.8+hotfix.4-stable.tar.xz | tar -C /opt -xJ

RUN apt-get install -y lib32stdc++6

WORKDIR ${PROJECT_DIR}
COPY ./ ./

RUN flutter doctor
RUN flutter upgrade
RUN flutter packages pub global activate webdev
RUN flutter packages upgrade

My docker-compose.yaml

version: '3.1'
services:
  api:
    container_name: flutter-web-test
    restart: always
    image: flutter-web-test
    build:
      context: ./
    volumes:
      - //var/run/docker.sock:/var/run/docker.sock
    command: ["flutter", "pub", "global", "run", "webdev", "serve", "web:5001"]

After executing docker-compose -f docker-compose.yaml build and docker-compose -f docker-compose.yaml up, I receive that server should be up.

flutter-web-test | web

flutter-web-test | [WARNING] Throwing away cached asset graph due to Dart SDK update.


flutter-web-test | [INFO] Cleaning up outputs from previous builds. completed, took 76ms

flutter-web-test | [INFO] Building new asset graph completed, took 2.5s

flutter-web-test | [INFO] Checking for unexpected pre-existing outputs. completed, took 2ms

flutter-web-test | [INFO] Serving `web` on http://127.0.0.1:5001

However, when I try to connect to http://127.0.0.1:5001 - I see This site cannot be reached window.

If I run it locally, it works perfectly fine. I believe I must have skipped something in Docker, but cannot find an issue. Anyone can help to spot an issue?




Aucun commentaire:

Enregistrer un commentaire