Skip to content

Instantly share code, notes, and snippets.

@pasindud
Last active March 29, 2021 09:04
Show Gist options
  • Save pasindud/a0124f8ee920712782a465ef49f3521b to your computer and use it in GitHub Desktop.
Save pasindud/a0124f8ee920712782a465ef49f3521b to your computer and use it in GitHub Desktop.
#Stage 1 - Install dependencies and build the app
FROM debian:latest AS build-env
# Install flutter dependencies
RUN apt-get update
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
# Clone the flutter repo
RUN git clone https://github.com/flutter/flutter.git /usr/local/flutter
# Set flutter path
# RUN /usr/local/flutter/bin/flutter doctor -v
ENV PATH="/usr/local/flutter/bin:/usr/local/flutter/bin/cache/dart-sdk/bin:${PATH}"
# Run flutter doctor
RUN flutter doctor -v
# Enable flutter web
RUN flutter channel master
RUN flutter upgrade
RUN flutter config --enable-web
# Copy files to container and build
RUN mkdir /app/
RUN flutter create myapp && cd myapp && flutter build web
# Stage 2 - Create the run-time image
FROM nginx
COPY --from=build-env /app/myapp/build/web /usr/share/nginx/html
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment