Skip to content

Commit

Permalink
Update devcontainer image and fix permission issues
Browse files Browse the repository at this point in the history
  • Loading branch information
takenagain committed May 21, 2024
1 parent 93dfbaa commit 1e351d0
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 22 deletions.
10 changes: 4 additions & 6 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,11 @@
"name": "flutter_docker",
"context": "..",
"dockerFile": "../.docker/android-dev.dockerfile",
"remoteUser": "mobiledevops",
"settings": {
"terminal.integrated.shell.linux": null
},
"remoteUser": "komodo",
"postAttachCommand": "sh .docker/dev-setup.sh",
"runArgs": [
"--privileged"
],
"workspaceMount": "source=${localWorkspaceFolder},target=/home/mobiledevops/workspace,type=bind,consistency=delegated",
"workspaceFolder": "/home/mobiledevops/workspace"
"workspaceMount": "source=${localWorkspaceFolder},target=/home/komodo/workspace,type=bind,consistency=delegated",
"workspaceFolder": "/home/komodo/workspace"
}
1 change: 0 additions & 1 deletion .docker/android-apk-build.dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ RUN apt update && \

WORKDIR /app

# TODO: add .dockerignore
COPY . .

# TODO: add .gitkeep files for the missing directories
Expand Down
32 changes: 17 additions & 15 deletions .docker/android-dev.dockerfile
Original file line number Diff line number Diff line change
@@ -1,26 +1,28 @@
FROM mobiledevops/android-sdk-image:34.0.0-jdk17 as final
FROM --platform=linux/amd64 ghcr.io/cirruslabs/android-sdk:34 as final

ENV FLUTTER_VERSION="2.8.1"
ENV FLUTTER_HOME "/home/mobiledevops/.flutter-sdk"
ENV USER="mobiledevops"
ENV FLUTTER_HOME "/home/komodo/.flutter-sdk"
ENV USER="komodo"
ENV PATH $PATH:$FLUTTER_HOME/bin

RUN apt update && apt install -y python3 python3-pip python3-venv && \
python3 -m venv /home/komodo/.venv && \
useradd -u 1001 -m $USER && \
usermod -aG sudo $USER && \
echo "$USER ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers && \
chown -R $USER:$USER /home/$USER

USER $USER

# Download and extract Flutter SDK
RUN mkdir $FLUTTER_HOME \
RUN mkdir -p /home/komodo/workspace \
&& chown -R $USER:$USER /home/komodo/workspace \
&& mkdir -p $FLUTTER_HOME \
&& cd $FLUTTER_HOME \
&& curl --fail --remote-time --silent --location -O https://storage.googleapis.com/flutter_infra_release/releases/stable/linux/flutter_linux_${FLUTTER_VERSION}-stable.tar.xz \
&& tar xf flutter_linux_${FLUTTER_VERSION}-stable.tar.xz --strip-components=1 \
&& rm flutter_linux_${FLUTTER_VERSION}-stable.tar.xz

ENV ANDROID_HOME "/opt/android-sdk-linux"
ENV ANDROID_SDK_ROOT $ANDROID_HOME
ENV PATH $PATH:$ANDROID_HOME/cmdline-tools:$ANDROID_HOME/cmdline-tools/bin:$ANDROID_HOME/platform-tools

RUN $ANDROID_HOME/cmdline-tools/bin/sdkmanager --sdk_root=${ANDROID_SDK_ROOT} --update && \
sdkmanager --install "cmdline-tools;latest" --sdk_root=${ANDROID_SDK_ROOT} && \
sdkmanager --install "platform-tools" --sdk_root=${ANDROID_SDK_ROOT}

RUN flutter config --no-analytics --android-sdk=$ANDROID_HOME \
&& rm flutter_linux_${FLUTTER_VERSION}-stable.tar.xz \
&& flutter config --no-analytics \
&& flutter precache \
&& yes "y" | flutter doctor --android-licenses \
&& flutter doctor \
Expand Down
5 changes: 5 additions & 0 deletions .docker/dev-setup.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
chmod u+rw,g+r komodo:komodo /home/komodo/workspace
mkdir -p android/app/src/main/cpp/libs/armeabi-v7a
mkdir -p android/app/src/main/cpp/libs/arm64-v8a
/home/komodo/.venv/bin/pip install -r .docker/requirements.txt
/home/komodo/.venv/bin/python .docker/update_api.py
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,8 @@ docker build -f .docker/android-apk-build.dockerfile . -t mobile_apk_build
docker run --rm -u 1001:1001 -v ./build:/app/build mobile_apk_build:latest
```

The build output should be in the following directory: `build/app/outputs/flutter-apk/app-release.apk`

## Run/Build with screenshot and video recording ON

```
Expand Down

0 comments on commit 1e351d0

Please sign in to comment.