Compare commits

..
1 Commits
Author SHA1 Message Date
florian 9e7cf94c16 Added steps to build inside Docker 2026-10-28 11:27:41 +01:00
2 changed files with 68 additions and 1 deletions

No files matched your search

+38
View File
@@ -0,0 +1,38 @@
FROM node:22-bookworm
ARG CMDLINE_TOOLS_VERSION=15859902
ARG ANDROID_PLATFORM=android-36
ARG ANDROID_BUILD_TOOLS=36.0.0
ARG ANDROID_NDK=27.1.12297006
RUN apt-get update && apt-get install -y --no-install-recommends \
openjdk-17-jdk-headless unzip curl ca-certificates git \
&& rm -rf /var/lib/apt/lists/* \
&& ln -s "$(dirname "$(dirname "$(readlink -f "$(which javac)")")")" /opt/java17
ENV JAVA_HOME=/opt/java17 \
ANDROID_HOME=/opt/android-sdk \
GRADLE_USER_HOME=/home/node/.gradle \
CI=1
ENV ANDROID_SDK_ROOT=$ANDROID_HOME
ENV PATH=$JAVA_HOME/bin:$ANDROID_HOME/cmdline-tools/latest/bin:$ANDROID_HOME/platform-tools:$PATH
RUN mkdir -p "$ANDROID_HOME/cmdline-tools" \
&& curl -fsSL -o /tmp/cmdline-tools.zip \
"https://dl.google.com/android/repository/commandlinetools-linux-${CMDLINE_TOOLS_VERSION}_latest.zip" \
&& unzip -q /tmp/cmdline-tools.zip -d "$ANDROID_HOME/cmdline-tools" \
&& mv "$ANDROID_HOME/cmdline-tools/cmdline-tools" "$ANDROID_HOME/cmdline-tools/latest" \
&& rm /tmp/cmdline-tools.zip \
&& yes | sdkmanager --licenses > /dev/null \
&& sdkmanager "platform-tools" "platforms;${ANDROID_PLATFORM}" \
"build-tools;${ANDROID_BUILD_TOOLS}" "ndk;${ANDROID_NDK}" \
&& chown -R node:node "$ANDROID_HOME"
RUN npm install -g eas-cli \
&& mkdir -p "$GRADLE_USER_HOME" && chown -R node:node /home/node \
# mounted repos are owned by a different uid; stop git complaining
&& git config --system --add safe.directory '*'
USER node
WORKDIR /workspace
CMD ["bash"]
+30 -1
View File
@@ -19,7 +19,7 @@ A React Native mobile application for receiving push notifications.
## Prerequisites ## Prerequisites
- Node.js (v14 or higher) - Node.js (v22)
- Firebase account with google-services.json - Firebase account with google-services.json
- Expo account with Firebase Admin SDK private key imported - Expo account with Firebase Admin SDK private key imported
- Installed eas-cli - Installed eas-cli
@@ -49,6 +49,35 @@ npm install
eas build --profile release --local --platform android eas build --profile release --local --platform android
``` ```
## Building from scratch via Docker
1. Clone the repository:
```bash
git clone <repository-url>
cd <project-directory>
```
2. Build the Docker image
```bash
docker build -t expo-android-builder .
```
3. Copy google-services.json to root directory and comment out google-services.json in `.gitignore` (or delete the entry)
```bash
sed -i '/google-services\.json/d' .gitignore
```
4. Use EAS to build
```bash
docker run --rm \
-v "$PWD":/workspace \
-v gradle-cache:/home/node/.gradle \
-e EXPO_TOKEN="$EXPO_TOKEN" \
expo-android-builder \
bash -c 'npm ci && eas build --profile release --local --platform android --non-interactive --output /workspace/notifier.apk'
```
## Configuration ## Configuration
### Backend URL ### Backend URL