FROM alpine:3.21

RUN mkdir /client

RUN apk add bash curl file git unzip which zip gcompat wget tar xz

#ENTRYPOINT bash

WORKDIR /client

RUN wget -O flutter.tar.xz https://storage.googleapis.com/flutter_infra_release/releases/stable/linux/flutter_linux_3.29.0-stable.tar.xz

RUN tar xf flutter.tar.xz

ENV PATH="/client/flutter/bin/:${PATH}"

RUN git config --global --add safe.directory /client/flutter

RUN flutter upgrade

RUN flutter doctor

COPY ./ /client/

RUN flutter build web

WORKDIR /client/build/web

EXPOSE 80/tcp

CMD ["dart", "run", "dhttpd", "--host", "0.0.0.0", "--port", "80"]
