Skip to content

Commit b936fd2

Browse files
chore(dockerFile): dual android sdk installation and conflicts (#2069)
* chore(devcontainer): fix dockerfile broken yarn repo in base image * Update .devcontainer/devcontainer.json Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com> * Update Dockerfile * Update devcontainer.json * Update Dockerfile * Update devcontainer.json * remove: redundant pnpm installation. * chore(dockerFile): dual android sdk installation and conflicts between them. This Commit, comments out certain Docker commands in dockerFile as it's used inside devcontainers too, which are not needed when using dev containers. But those should be uncommented for Standalone Docker Build in the dockerFile. * Update .devcontainer/Dockerfile Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com> * Update Dockerfile to install Android SDK conditionally * chore(docker): split into multi-stage setup to allow devcontainers * remove(contributing): dockerFile uncomment note as it's resolved now. * fix `ARG` order in the dockerFile * update: specify 'standalone' target in Docker build command Updated Docker build command to specify the 'standalone' target. * fix: move ARG below FROM * update: ANDROID paths * update(CONTRIBUTING.md): add note for podman Mentioning about containers/buildah#5845 * fix(CONTRIBUTING.md): `Podmon` to Podman. --------- Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
1 parent fa02c4d commit b936fd2

3 files changed

Lines changed: 44 additions & 27 deletions

File tree

.devcontainer/Dockerfile

Lines changed: 33 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,19 @@
1-
# Acode Development Container - Standalone Docker Build
2-
#
3-
# This Dockerfile is for MANUAL Docker builds (docker build/run).
4-
# Usage:
5-
# docker build -t acode-dev .devcontainer/
1+
# Acode Development Container
2+
#
3+
# Devcontainer usage: automatic via devcontainer.json
4+
# Standalone usage:
5+
# docker build --target standalone -t acode-dev .devcontainer/
66
# docker run -it -v $(pwd):/workspaces/acode acode-dev
77

8-
FROM mcr.microsoft.com/devcontainers/java:1-21-bullseye
8+
FROM mcr.microsoft.com/devcontainers/java:1-21-bullseye AS base
99

1010
ARG ANDROID_PLATFORM=36
1111
ARG ANDROID_BUILD_TOOLS=36.0.0
1212
ARG CMDLINE_TOOLS_VERSION=11076708
1313
ARG NODE_VERSION=22
1414
ARG GRADLE_VERSION=8.11
1515

16-
ENV ANDROID_HOME=/opt/android-sdk
17-
ENV ANDROID_SDK_ROOT=/opt/android-sdk
1816
ENV GRADLE_HOME=/opt/gradle
19-
ENV PATH="${PATH}:${ANDROID_HOME}/cmdline-tools/latest/bin:${ANDROID_HOME}/platform-tools:${GRADLE_HOME}/bin"
2017

2118
# removes broken yarn repo present in base image
2219
RUN rm -f /etc/apt/sources.list.d/yarn.list
@@ -33,17 +30,26 @@ RUN wget -q "https://services.gradle.org/distributions/gradle-${GRADLE_VERSION}-
3330
&& rm /tmp/gradle.zip \
3431
&& ln -s /opt/gradle-${GRADLE_VERSION} ${GRADLE_HOME}
3532

36-
# Install fnm and Node.js
37-
# Not required, mostly. When dev containers are used.
38-
# ENV FNM_DIR=/usr/local/fnm
39-
# ENV PATH="${FNM_DIR}:${PATH}"
40-
# RUN curl -fsSL https://fnm.vercel.app/install | bash -s -- --install-dir "${FNM_DIR}" --skip-shell \
41-
# && eval "$(${FNM_DIR}/fnm env)" \
42-
# && fnm install ${NODE_VERSION} \
43-
# && fnm default ${NODE_VERSION} \
44-
# && npm install -g pnpm
33+
ENV PATH="${PATH}:${GRADLE_HOME}/bin"
34+
35+
WORKDIR /workspaces/acode
36+
37+
LABEL org.opencontainers.image.authors="Acode Foundation <https://github.com/Acode-Foundation/Acode>"
38+
LABEL description="Development environment for building Acode - Code Editor for Android"
39+
4540

46-
# ENV PATH="${FNM_DIR}/aliases/default/bin:${PATH}"
41+
# Devcontainer stage
42+
# Android SDK and Node handled by devcontainer features.
43+
FROM base AS devcontainer
44+
45+
46+
# Standalone stage
47+
# Includes Android SDK and Node/pnpm for plain docker build/run usage.
48+
FROM base AS standalone
49+
50+
ENV ANDROID_HOME=/usr/local/lib/android
51+
ENV ANDROID_SDK_ROOT=/usr/local/lib/android
52+
ENV PATH="${PATH}:${ANDROID_HOME}/cmdline-tools/latest/bin:${ANDROID_HOME}/platform-tools:${ANDROID_HOME}/build-tools/${ANDROID_BUILD_TOOLS}"
4753

4854
# Install Android SDK
4955
RUN mkdir -p ${ANDROID_HOME}/cmdline-tools \
@@ -59,7 +65,12 @@ RUN mkdir -p ${ANDROID_HOME}/cmdline-tools \
5965
"platforms;android-${ANDROID_PLATFORM}" \
6066
"build-tools;${ANDROID_BUILD_TOOLS}"
6167

62-
WORKDIR /workspaces/acode
68+
# Install fnm and Node.js
69+
ENV FNM_DIR=/usr/local/fnm
70+
RUN curl -fsSL https://fnm.vercel.app/install | bash -s -- --install-dir "${FNM_DIR}" --skip-shell \
71+
&& eval "$(${FNM_DIR}/fnm env)" \
72+
&& fnm install ${NODE_VERSION} \
73+
&& fnm default ${NODE_VERSION} \
74+
&& npm install -g pnpm
6375

64-
LABEL maintainer="Acode Foundation"
65-
LABEL description="Development environment for building Acode - Code Editor for Android"
76+
ENV PATH="${FNM_DIR}/aliases/default/bin:${PATH}"

.devcontainer/devcontainer.json

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,25 @@
11
{
22
"name": "Acode Development",
33
"build": {
4-
"dockerfile": "Dockerfile"
4+
"dockerfile": "Dockerfile",
5+
"target": "devcontainer"
56
},
67

78
"containerEnv": {
89
"JAVA_HOME": "/usr/local/openjdk-21"
910
},
1011
"remoteEnv": {
11-
"JAVA_HOME": "/usr/local/openjdk-21"
12+
"JAVA_HOME": "/usr/local/openjdk-21",
13+
"ANDROID_SDK_ROOT": "${containerEnv:ANDROID_HOME}",
14+
"PATH": "${containerEnv:PATH}:${containerEnv:ANDROID_HOME}/build-tools/36.0.0"
1215
},
1316

1417
"features": {
1518
"ghcr.io/nordcominc/devcontainer-features/android-sdk:1": {
1619
"platform": "36",
1720
"build_tools": "36.0.0"
1821
},
19-
"ghcr.io/devcontainers/features/node:1": {
22+
"ghcr.io/devcontainers/features/node:2.0": {
2023
"nodeGypDependencies": false,
2124
"installYarnUsingApt": false,
2225
"version": "lts",

CONTRIBUTING.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ Thank you for your interest in contributing to Acode! This guide will help you g
66

77
### Option 1: DevContainer (Recommended)
88

9-
1. Install the [Dev Containers extension](https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-containers) in VS Code or other editors that support DevContainers.
9+
1. Install the [Dev Containers extension](https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-containers) in VS Code or other editors that support [DevContainers](https://containers.dev/).
1010

1111
2. Clone and open the repository:
1212
```bash
@@ -28,6 +28,9 @@ Thank you for your interest in contributing to Acode! This guide will help you g
2828
2929
### Option 2: Docker CLI (For Any Editor)
3030

31+
> [!NOTE]
32+
> If you try to use Podman, Kindly note that it would not work properly until https://github.com/containers/buildah/pull/5845 is merged/implemented in Podman.
33+
3134
If your editor doesn't support DevContainers, you can use Docker directly:
3235

3336
```bash
@@ -36,7 +39,7 @@ git clone https://github.com/Acode-Foundation/Acode.git
3639
cd Acode
3740

3841
# Build the Docker image from our Dockerfile
39-
docker build -t acode-dev .devcontainer/
42+
docker build --target standalone -t acode-dev .devcontainer/
4043

4144
# Run the container with your code mounted
4245
docker run -it --rm \

0 commit comments

Comments
 (0)