|
| 1 | +image: |
| 2 | + file: .gitpod.Dockerfile |
| 3 | +tasks: |
| 4 | + - before: sudo mount -t tmpfs shm -osize=4096m /dev/shm |
| 5 | + - init: | |
| 6 | + flutter channel beta |
| 7 | + flutter upgrade |
| 8 | + flutter config --enable-web |
| 9 | + flutter config --android-sdk /home/gitpod/androidsdk |
| 10 | + yes | flutter doctor --android-licenses |
| 11 | + flutter doctor |
| 12 | + flutter pub get |
| 13 | + flutter build -v bundle |
| 14 | + flutter build -v web |
| 15 | + flutter build -v appbundle |
| 16 | + flutter build -v apk |
| 17 | + |
| 18 | + - command: | |
| 19 | + # Gitpod is not able to run emulators within a worspace at this stage as |
| 20 | + # Google Kubernetes Engine does not support Nested Virtualization. |
| 21 | + # |
| 22 | + # If running Gitpod on your own infrastructure or via the Dockerfile locally |
| 23 | + # on infrastructure that exposes vmx or svm then this command will launch |
| 24 | + # the emulator. |
| 25 | + # |
| 26 | + # $ emulator -avd avd28 -no-audio -no-window |
| 27 | + # |
| 28 | + # Until this restriction is mitigated you can run native mobile apps in your |
| 29 | + # browser via https://appetize.io/ |
| 30 | + if [[ -z "$APPETIZE_API_TOKEN" ]]; then |
| 31 | + echo "Appetize API token not set. Run:" |
| 32 | + echo "" |
| 33 | + echo " gp env APPETIZE_API_TOKEN=your_token" |
| 34 | + echo "" |
| 35 | + echo "and restart this workspace in order to get an app preview." |
| 36 | + echo "" |
| 37 | + echo "Request your token here: https://appetize.io/docs#request-api-token" |
| 38 | + else |
| 39 | + curl -sS --http1.1 "https://[email protected]/v1/apps/$APPETIZE_PUBLICKEY" \ |
| 40 | + -F "file=@/workspace/template-flutter/build/app/outputs/flutter-apk/app.apk" \ |
| 41 | + -F platform=android \ |
| 42 | + -F "buttonText=Start App" \ |
| 43 | + -F "postSessionButtonText=Start App" \ |
| 44 | + > .appetize.json |
| 45 | + APPETIZE_PUBLICKEY=$(jq -r .publicKey .appetize.json) |
| 46 | + gp env "APPETIZE_PUBLICKEY=$APPETIZE_PUBLICKEY" |
| 47 | + export APPETIZE_PUBLICKEY |
| 48 | + python -m webbrowser "https://appetize.io/embed/$APPETIZE_PUBLICKEY?device=pixel4&autoplay=true" |
| 49 | + fi |
| 50 | + flutter devices |
| 51 | + |
| 52 | + flutter run --web-port 8080 |
| 53 | + - command: | |
| 54 | + dart pub get |
| 55 | + |
| 56 | +ports: |
| 57 | + - port: 5900 |
| 58 | + onOpen: ignore |
| 59 | + # vnc |
| 60 | + - port: 6080 |
| 61 | + onOpen: open-preview |
| 62 | + # flutter |
| 63 | + - port: 8080 |
| 64 | + onOpen: open-preview |
| 65 | + |
| 66 | +vscode: |
| 67 | + extensions: |
| 68 | + - dart-code.flutter |
0 commit comments