Last active
March 18, 2020 02:36
-
-
Save bus710/c4c65b8798d356ce731979e5f784448b to your computer and use it in GitHub Desktop.
Building Flutter-web project in docker container but without Flutter SDK
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
Author
bus710
commented
Mar 10, 2020
•
- These have been used in Debian based OSes.
- Install docker and add your account to docker group.
- Place those files in a flutter project root (next to pubspec.yml).
- Run the shell script.
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