Skip to content

Instantly share code, notes, and snippets.

@bus710
Last active March 18, 2020 02:36
Show Gist options
  • Save bus710/c4c65b8798d356ce731979e5f784448b to your computer and use it in GitHub Desktop.
Save bus710/c4c65b8798d356ce731979e5f784448b to your computer and use it in GitHub Desktop.
Building Flutter-web project in docker container but without Flutter SDK
#!/bin/bash
docker pull cirrusci/flutter:latest-web
docker image build -t flutter_frontend:latest .
docker create -ti --name dummy flutter_frontend:latest bash
docker cp dummy:/usr/local/flutter_frontend/build ./build
docker rm -f dummy
# (Option) To move the output to somewhere else
mkdir ${HOME}/output
cp -r ./build/web/* ${HOME}/output
chown -R ${USER}:${USER} ${HOME}/output/*
FROM cirrusci/flutter:latest-web AS build
COPY . /usr/local/flutter_frontend
WORKDIR /usr/local/flutter_frontend
RUN sudo chown -R cirrus:cirrus ./*
RUN sudo chown -R cirrus:cirrus ./.*
RUN sudo rm -f .packages
RUN flutter config --enable-web
RUN flutter pub get
RUN flutter build web
@bus710
Copy link
Author

bus710 commented Mar 18, 2020

If flutter web output file should be used in a docker-compose based system,
Please consider multi-stage of compose syntax.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment