softplayer-web/Containerfile
2024-04-04 23:40:00 +02:00

35 lines
925 B
Docker

# Environemnt to install flutter and build web
FROM debian:latest AS build-env
# install all needed stuff
RUN apt-get update
RUN apt-get install -y curl tar xz-utils git
# define variables
ARG FLUTTER_SDK=/usr/local/flutter
RUN mkdir -p ${FLUTTER_SDK}
ARG FLUTTER_VERSION=3.19.5
ARG APP=/app/
RUN curl -l -o /tmp/flutter.tar.xz https://storage.googleapis.com/flutter_infra_release/releases/stable/linux/flutter_linux_${FLUTTER_VERSION}-stable.tar.xz
RUN tar -xf /tmp/flutter.tar.xz -C /usr/local
ENV PATH="$FLUTTER_SDK/bin:$FLUTTER_SDK/bin/cache/dart-sdk/bin:${PATH}"
RUN mkdir $APP
COPY . $APP
WORKDIR $APP
RUN flutter build web --web-renderer html
# once heare the app will be compiled and ready to deploy
# use nginx to deploy
FROM nginx
# copy the info of the builded web app to nginx
COPY --from=build-env /app/build/web /usr/share/nginx/html
# Expose and run nginx
EXPOSE 80
CMD ["nginx", "-g", "daemon off;"]