Added steps to build inside Docker
This commit is contained in:
1 parent
9d58394845
commit
9e7cf94c16
2 files changed
+68
-1
No files matched your search
+38
@@ -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"]
|
||||
@@ -19,7 +19,7 @@ A React Native mobile application for receiving push notifications.
|
||||
|
||||
## Prerequisites
|
||||
|
||||
- Node.js (v14 or higher)
|
||||
- Node.js (v22)
|
||||
- Firebase account with google-services.json
|
||||
- Expo account with Firebase Admin SDK private key imported
|
||||
- Installed eas-cli
|
||||
@@ -49,6 +49,35 @@ npm install
|
||||
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
|
||||
|
||||
### Backend URL
|
||||
|
||||
Reference in new issue
Block a user