Created
September 10, 2022 11:18
-
-
Save lablnet/09a1c7e511e3cac3eaaf2795c1ad5a4e to your computer and use it in GitHub Desktop.
Flutter Dev Container For GitHub CodeSpace / VS Code.
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
Show hidden characters
// For format details, see https://aka.ms/devcontainer.json. For config options, see the README at: | |
// https://github.com/microsoft/vscode-dev-containers/tree/v0.191.1/containers/codespaces-linux | |
{ | |
"name": "Flutter Dev environment (built on default Codespaces image)", | |
"build": { | |
"dockerfile": "Dockerfile" | |
}, | |
"remoteUser": "codespace", | |
"overrideCommand": false, | |
"mounts": ["source=codespaces-linux-var-lib-docker,target=/var/lib/docker,type=volume"], | |
"runArgs": [ | |
"--cap-add=SYS_PTRACE", | |
"--security-opt", | |
"seccomp=unconfined", | |
"--privileged", | |
"--init" | |
], | |
// Add the IDs of extensions you want installed when the container is created. | |
"extensions": [ | |
"GitHub.vscode-pull-request-github", | |
"dart-code.flutter", | |
"dart-code.dart-code" | |
], | |
// Use 'forwardPorts' to make a list of ports inside the container available locally. | |
"forwardPorts": [3000], | |
// "oryx build" will automatically install your dependencies and attempt to build your project | |
"postCreateCommand": "oryx build -p virtualenv_name=.venv --log-file /tmp/oryx-build.log --manifest-dir /tmp || echo 'Could not auto-build. Skipping.'" | |
} |
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 mcr.microsoft.com/vscode/devcontainers/universal:1-focal | |
USER root | |
# [Optional] Uncomment this section to install additional OS packages. | |
# RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \ | |
# && apt-get -y install --no-install-recommends <your-package-list-here> | |
USER codespace | |
RUN mkdir /home/codespace/opt && cd /home/codespace/opt && git clone https://github.com/flutter/flutter.git -b stable && \ | |
wget https://dl.google.com/android/repository/commandlinetools-linux-7583922_latest.zip && \ | |
unzip commandlinetools-linux-7583922_latest.zip && \ | |
mkdir android-sdk && mkdir android-sdk/platform-tools && mkdir android-sdk/cmdline-tools && \ | |
mv cmdline-tools android-sdk/cmdline-tools/latest && \ | |
rm commandlinetools-linux-7583922_latest.zip | |
ENV PATH $PATH:/home/codespace/opt/flutter/bin | |
ENV ANDROID_SDK_ROOT /home/codespace/opt/android-sdk | |
ENV PATH $PATH:$ANDROID_SDK_ROOT/cmdline-tools/latest/bin | |
ENV PATH $PATH:$ANDROID_SDK_ROOT/platform-tools | |
RUN yes | sdkmanager --licenses && \ | |
sdkmanager --sdk_root=${ANDROID_SDK_ROOT} "platform-tools" "platforms;android-30" "build-tools;30.0.3" && \ | |
flutter config --android-sdk $ANDROID_SDK_ROOT && \ | |
flutter precache |
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 | |
flutter run --release -d web-server --web-hostname=0.0.0.0 --web-port=3000 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment