Skip to content

Commit aa39401

Browse files
SwapLab Engine: Desktop Android Core 🐳
0 parents  commit aa39401

File tree

4 files changed

+364
-0
lines changed

4 files changed

+364
-0
lines changed
Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
name: Publish Core Image to GHCR
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
# Optional: Trigger on version tags (e.g., v1.0.0)
8+
tags:
9+
- 'v*.*.*'
10+
workflow_dispatch:
11+
12+
env:
13+
REGISTRY: ghcr.io
14+
IMAGE_NAME: ${{ github.repository }}
15+
16+
jobs:
17+
build-and-push-core:
18+
runs-on: ubuntu-latest
19+
permissions:
20+
contents: read
21+
packages: write
22+
id-token: write # Required for Cosign keyless signing
23+
24+
steps:
25+
- name: Checkout repository
26+
uses: actions/checkout@v4
27+
28+
# Optimization: Clean up disk space before heavy build
29+
- name: Prune Docker System
30+
run: |
31+
docker system prune -af --volumes || true
32+
33+
- name: Log in to GitHub Container Registry
34+
uses: docker/login-action@v3
35+
with:
36+
registry: ${{ env.REGISTRY }}
37+
username: ${{ github.actor }}
38+
password: ${{ secrets.GITHUB_TOKEN }}
39+
40+
- name: Set up Docker Buildx
41+
uses: docker/setup-buildx-action@v3
42+
43+
- name: Extract metadata (tags, labels)
44+
id: meta
45+
uses: docker/metadata-action@v5
46+
with:
47+
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
48+
tags: |
49+
# Default tag 'latest' on main branch
50+
type=raw,value=latest,enable={{is_default_branch}}
51+
# Tag based on git tag (v1.0.0)
52+
type=ref,event=tag
53+
# Tag based on sha (optional for debugging)
54+
type=sha,format=long
55+
labels: |
56+
org.opencontainers.image.title=SwapLab Android Build Engine
57+
org.opencontainers.image.vendor=SwapLab Engine
58+
org.opencontainers.image.licenses=Proprietary
59+
org.opencontainers.image.source=https://github.com/swaplab-engine/desktop-android-core
60+
org.opencontainers.image.url=https://github.com/swaplab-engine/desktop-android-core
61+
org.opencontainers.image.description=Official build engine. Public Core Image.
62+
63+
- name: Build and Push Core Image
64+
id: build-and-push
65+
uses: docker/build-push-action@v5
66+
with:
67+
context: .
68+
push: true
69+
tags: ${{ steps.meta.outputs.tags }}
70+
labels: ${{ steps.meta.outputs.labels }}
71+
cache-from: type=gha
72+
cache-to: type=gha,mode=max
73+
provenance: true
74+
75+
# Security: Sign the image with Sigstore/Cosign
76+
- name: Install Cosign
77+
if: success()
78+
uses: sigstore/cosign-installer@v3
79+
with:
80+
cosign-release: 'v2.2.4'
81+
82+
- name: Sign the Docker image
83+
if: success()
84+
env:
85+
COSIGN_EXPERIMENTAL: 1
86+
IMAGE_DIGEST: ${{ steps.build-and-push.outputs.digest }}
87+
run: |
88+
echo "Signing image digest: ${IMAGE_DIGEST}"
89+
# Sign the image using the GitHub OIDC token
90+
cosign sign --yes "${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}@${IMAGE_DIGEST}"

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
*.DS_Store

Dockerfile

Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
# ===================================================================
2+
# SWAPLAB ENGINE: DESKTOP ANDROID CORE (PUBLIC BASE IMAGE)
3+
# Repo: swaplab-engine/desktop-android-core
4+
# Description: Public base image providing a transparent, optimized,
5+
# and pre-configured environment strictly for Android builds.
6+
# ===================================================================
7+
FROM ubuntu:22.04 AS desktop-android-core
8+
9+
ENV DEBIAN_FRONTEND=noninteractive
10+
ENV LANG=en_US.UTF-8
11+
12+
# -------------------------------------------------------------------
13+
# 1. System Dependencies Installation
14+
# -------------------------------------------------------------------
15+
# Kept: openjdk-21-jdk, git, unzip, gradle dependencies
16+
RUN apt-get update && apt-get install -y --no-install-recommends \
17+
ca-certificates \
18+
openjdk-21-jdk \
19+
jq \
20+
python3 \
21+
unzip \
22+
curl \
23+
zip \
24+
git \
25+
locales \
26+
wget \
27+
gnupg \
28+
lsb-release \
29+
apt-transport-https \
30+
build-essential \
31+
&& rm -rf /var/lib/apt/lists/* \
32+
&& locale-gen en_US.UTF-8
33+
34+
# -------------------------------------------------------------------
35+
# 2. Security Tools (Transparency Layer)
36+
# -------------------------------------------------------------------
37+
# Trivy (SCA - Software Composition Analysis)
38+
RUN wget -qO - https://aquasecurity.github.io/trivy-repo/deb/public.key | gpg --dearmor -o /usr/share/keyrings/trivy.gpg && \
39+
echo "deb [signed-by=/usr/share/keyrings/trivy.gpg] https://aquasecurity.github.io/trivy-repo/deb $(lsb_release -sc) main" > /etc/apt/sources.list.d/trivy.list && \
40+
apt-get update && \
41+
apt-get install -y --no-install-recommends trivy && \
42+
rm -rf /var/lib/apt/lists/*
43+
44+
# -------------------------------------------------------------------
45+
# 3. Android SDK & Build Tools Installation
46+
# -------------------------------------------------------------------
47+
ARG ANDROID_SDK_VERSION=11076708
48+
ARG ANDROID_BUILD_TOOLS_VERSION=35.0.0
49+
ARG ANDROID_PLATFORM_VERSION=35
50+
ENV ANDROID_HOME=/usr/lib/android-sdk
51+
ENV PATH=$PATH:${ANDROID_HOME}/cmdline-tools/latest/bin:${ANDROID_HOME}/platform-tools
52+
53+
# Download & Setup Command Line Tools
54+
RUN mkdir -p ${ANDROID_HOME}/cmdline-tools && \
55+
curl -o android_tools.zip https://dl.google.com/android/repository/commandlinetools-linux-${ANDROID_SDK_VERSION}_latest.zip && \
56+
unzip -d ${ANDROID_HOME}/cmdline-tools android_tools.zip && \
57+
mv ${ANDROID_HOME}/cmdline-tools/cmdline-tools ${ANDROID_HOME}/cmdline-tools/latest && \
58+
rm android_tools.zip
59+
60+
# Accept Licenses & Install Platforms
61+
RUN yes | sdkmanager --licenses && \
62+
sdkmanager --install "platform-tools" "platforms;android-${ANDROID_PLATFORM_VERSION}" "build-tools;${ANDROID_BUILD_TOOLS_VERSION}"
63+
64+
# -------------------------------------------------------------------
65+
# 4. Gradle Installation
66+
# -------------------------------------------------------------------
67+
ARG GRADLE_VERSION=8.11.1
68+
ENV GRADLE_HOME=/opt/gradle/gradle-${GRADLE_VERSION}
69+
RUN curl -o gradle.zip -L https://services.gradle.org/distributions/gradle-${GRADLE_VERSION}-bin.zip && \
70+
unzip -d /opt/gradle gradle.zip && \
71+
rm gradle.zip
72+
73+
# -------------------------------------------------------------------
74+
# 5. Node.js Environment
75+
# -------------------------------------------------------------------
76+
RUN curl -fsSL https://deb.nodesource.com/setup_20.x | bash - \
77+
&& apt-get update && apt-get install -y --no-install-recommends nodejs \
78+
&& rm -rf /var/lib/apt/lists/*
79+
80+
# -------------------------------------------------------------------
81+
# 6. Mobile Development CLI Suite (Android Focused)
82+
# -------------------------------------------------------------------
83+
# Installing all necessary CLIs for SwapLab Desktop support
84+
# - xml2js & plist: Kept for compatibility with Cordova Hooks (config.xml parsing)
85+
RUN npm install -g \
86+
@capacitor/cli@7.1.0 \
87+
cordova \
88+
framework7-cli \
89+
xml2js \
90+
plist
91+
92+
# Final Environment Variables Setup
93+
ENV GRADLE_USER_HOME=/github/workspace/.gradle
94+
ENV PATH=${PATH}:${GRADLE_HOME}/bin
95+
96+
CMD ["npm", "version"]

README.md

Lines changed: 177 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,177 @@
1+
# SwapLab Engine: Desktop Android Core 🐳
2+
3+
[![Docker Image Version](https://img.shields.io/docker/v/swaplab-engine/desktop-android-core?sort=semver&color=blue)](https://github.com/swaplab-engine/desktop-android-core/pkgs/container/desktop-android-core)
4+
[![License](https://img.shields.io/badge/License-Proprietary-red)](#)
5+
[![Security Scan](https://img.shields.io/badge/Security-Trivy%20Scanned-success)](https://github.com/aquasecurity/trivy)
6+
7+
> **💸 100% FREE & UNRESTRICTED**
8+
> **No hidden costs. No locked features. No premium tiers.**
9+
> SwapLab Desktop is purely a tool to empower developers.
10+
11+
**The transparent, secure, and immutable build environment powering [SwapLab Desktop](https://desktop.swaplab.net).**
12+
13+
This repository hosts the **public Dockerfile** used to build the core engine for SwapLab Desktop. We believe in total transparency: you should know exactly what tools (Android SDK, Gradle, Java) are compiling your code.
14+
15+
---
16+
17+
## ⚠️ Critical Requirement
18+
19+
> **SwapLab Desktop acts solely as a trigger.** The build process executes entirely inside Docker containers. **SwapLab Desktop will NOT function without Docker Desktop installed and running.**
20+
21+
---
22+
23+
## 🛡️ Architecture: Transparency vs. Logic
24+
25+
To ensure both **Community Trust** (Transparency) and **Operational Integrity** (Security), our architecture is split into two distinct layers. Both are publicly available for use:
26+
27+
| Layer | Image Name | Status | Description |
28+
| :--- | :--- | :--- | :--- |
29+
| **1. Base Core** | `swaplab-engine/desktop-android-core` | **Open Source** (This Repo) | Contains the raw environment: OS, JDK, Android SDK, and Gradle. **Open for security auditing.** You can verify that the environment is clean and standard. |
30+
| **2. Build Engine** | `swaplab-desktop-android-engine` | **Public Package** | This is the final executable image used by the Desktop App. It is built *on top* of this Base Core but includes our **Proprietary Automation Logic** to manage the complex build process seamlessly.<br><br>**Official Packages:**<br>🍎 [View iOS Engine on GHCR](https://github.com/swaplab-engine/desktop-ios-core/pkgs/container/swaplab-desktop-ios-engine)<br>🤖 [View Android Engine on GHCR](https://github.com/swaplab-engine/desktop-android-core/pkgs/container/swaplab-desktop-android-engine) |
31+
32+
### 🐳 Public Docker Hub Availability
33+
34+
The build engine images are released publicly on Docker Hub. You can verify and download them directly:
35+
36+
1. **CLI Command:** `docker run swaplab/swaplab-desktop-android-engine:v1.0.0`
37+
2. **Via Docker Desktop App:**
38+
You can easily find these images using the Docker Desktop GUI:
39+
* Open the **Docker Desktop** app.
40+
* In the search bar, type `swaplab`.
41+
* You will see **`swaplab/swaplab-desktop-android-engine:v1.0.0`** and **`swaplab/swaplab-desktop-ios-engine:v1.0.0`**.
42+
* Simply click the **Pull** button to download them manually if desired.
43+
44+
---
45+
46+
## 🚀 Why SwapLab Desktop?
47+
48+
Building Android apps usually requires hours of setting up Java, Gradle, Android Studio, Environment Variables, and dealing with conflicting CLI versions. **SwapLab eliminates all of that.**
49+
50+
SwapLab Desktop is a lightweight (~10MB) GUI controller that triggers this Docker Engine to perform complex builds in **seconds**, not minutes.
51+
52+
### ✨ Key Features
53+
54+
* **🚫 NO CLI / NO Config:** Forget `cordova requirements`, `JAVA_HOME`, or `ANDROID_HOME` errors. It just works out of the box.
55+
* **🔒 100% Privacy & Control:**
56+
* **No Sign-In Required:** We don't ask for your email or personal data.
57+
* **No Data Collection:** Your source code **NEVER** leaves your machine.
58+
* **Local Execution:** Everything runs locally on your localhost.
59+
* **⚡ Blazing Fast:** Leveraging aggressive caching strategies (Gradle & NPM), subsequent builds take seconds.
60+
* **🌐 Offline Capable:** Once the engine image is downloaded, you can build apps without an internet connection.
61+
* **🛡️ Isolated Environment:** Builds run inside ephemeral Docker containers. Your host OS remains clean and uncluttered.
62+
63+
---
64+
65+
## 🎨 Build Anything, From Anywhere
66+
67+
**Compatible with any framework that exports web assets (HTML/CSS/JS).**
68+
If it runs in a browser, SwapLab can turn it into a native app.
69+
70+
> 🧪 **Want to test it now?** Clone our ready-to-use samples:
71+
> [**https://github.com/swaplab-engine/desktop-simple-project**](https://github.com/swaplab-engine/desktop-simple-project)
72+
73+
| Game Engines | Modern Web | UI & Classic |
74+
| :--- | :--- | :--- |
75+
| 🎮 **Construct 3** | ⚛️ **React** | 📱 **Ionic** |
76+
| 🎮 **Construct 2** | 🟢 **Vue / Vuetify** | 🎨 **Framework7** |
77+
| | 🅰️ **Angular** |**Alpine.js** |
78+
| |**Next.js** | 📦 **Vanilla JS** |
79+
| | 🟠 **Svelte / Preact** | 💎 **Stencil** |
80+
| | 🟦 **SolidJS** | 🅱️ **Bootstrap** |
81+
| | 🚀 **Astro / Remix** | 🐦 **Flutter (Web)** |
82+
83+
---
84+
85+
## 🛠️ Workflow Architecture
86+
87+
SwapLab Desktop acts as a secure **trigger**. It orchestrates a fleeting Docker container using our engine to compile your code without polluting your system.
88+
89+
```mermaid
90+
graph TD
91+
A[User's Project] -->|Mount Volume| B(SwapLab Desktop App)
92+
B -->|Trigger Build| C{Docker Desktop}
93+
C -->|Spin Up Container| D[Desktop Android Core Image]
94+
D -->|Compile APK/AAB| E[Output Folder]
95+
96+
style D fill:#4CAF50,stroke:#333,stroke-width:2px,color:white
97+
```
98+
99+
1. **Inheritance:** The engine inherits this transparent public core.
100+
2. **Automation:** Our internal logic orchestrates the Gradle build process automatically.
101+
3. **Result:** A fully compiled, signed APK or AAB file ready for the Play Store.
102+
103+
---
104+
105+
## 📦 What's Inside This Core?
106+
107+
This image is optimized strictly for **Android builds**. It is stripped of unnecessary bloat (like Ruby/CocoaPods) to ensure maximum speed and security.
108+
109+
| Component | Version | Description |
110+
| :--- | :--- | :--- |
111+
| **OS** | Ubuntu 22.04 LTS | Stable Linux Foundation |
112+
| **Android SDK** | API Level 35 | Latest Build Tools (35.0.0) |
113+
| **Gradle** | v8.11.1 | High-performance build automation |
114+
| **Node.js** | v20 (LTS) | JavaScript Runtime |
115+
| **Java** | OpenJDK 21 | Required for modern Android builds |
116+
| **xml2js / plist** | Latest | **Cordova Plugin Hook Dependencies** |
117+
| **Security** | Trivy | Embedded vulnerability scanner |
118+
119+
> **Note:** This image does **NOT** contain Ruby or CocoaPods. For iOS preparation, we use a separate [iOS Core](https://github.com/swaplab-engine/desktop-ios-core).
120+
121+
---
122+
123+
## 📥 Getting Started
124+
125+
### 1. Install Docker Desktop (Required)
126+
SwapLab requires a Docker Engine to run this core.
127+
* **Mac:** [Install Docker for Mac](https://docs.docker.com/desktop/setup/install/mac-install/)
128+
* **Windows:** [Install Docker for Windows](https://docs.docker.com/desktop/setup/install/windows-install/)
129+
130+
> **💡 Pro Tip:** You do **NOT** need to sign in to Docker Desktop. You can simply **skip the login step**. Just ensure the Docker Engine status is **"Running"**.
131+
132+
### 2. Download SwapLab Desktop
133+
Get the lightweight controller for your OS.
134+
* **Download:** [desktop.swaplab.net](https://desktop.swaplab.net)
135+
* **Size:** ~10 MB
136+
137+
### 3. Build Your App
138+
Open SwapLab Desktop, select your project folder, and hit **Start Process**.
139+
140+
---
141+
142+
## 🔍 Transparency Verification
143+
144+
We open-source this Dockerfile so you can verify that **no malicious scripts** or **backdoors** exist in our build environment.
145+
146+
### Manual Verification (Optional)
147+
If you are a power user, you can inspect the image manually using your terminal:
148+
149+
~~~bash
150+
# Pull the public base image
151+
docker pull ghcr.io/swaplab-engine/desktop-android-core:latest
152+
153+
# Enter the container shell
154+
docker run -it --rm ghcr.io/swaplab-engine/desktop-android-core:latest bash
155+
156+
# Check versions
157+
java -version
158+
gradle -v
159+
# Note: This container only holds the tools. It does not contain the automation logic.
160+
~~~
161+
162+
---
163+
164+
## ☁️ Cloud vs. Desktop
165+
166+
| Feature | SwapLab Cloud | **SwapLab Desktop (This)** |
167+
| :--- | :---: | :---: |
168+
| **Infrastructure** | Our High-Spec Servers | Your Local Machine (Docker) |
169+
| **Setup** | Zero (Web Browser) | Minimal (Install Docker) |
170+
| **Privacy** | Secure Upload & Delete | **100% Local / Offline** |
171+
| **Control** | Managed | **Full Control** |
172+
| **Sign-In** | Required | **No Sign-In** |
173+
| **Link** | [swaplab.net](https://swaplab.net) | [desktop.swaplab.net](https://desktop.swaplab.net) |
174+
175+
---
176+
177+
**SwapLab***Build Native Apps. Simply.*

0 commit comments

Comments
 (0)