Introduce Dockerfile for easy compilation

pull/392/head
E. Iosifidis 2024-12-14 12:44:06 +02:00
rodzic 19847cb235
commit 896fd6382e
3 zmienionych plików z 88 dodań i 1 usunięć

50
Dockerfile 100644
Wyświetl plik

@ -0,0 +1,50 @@
# Base image
FROM ubuntu:20.04
# Set environment variables to ensure non-interactive mode and set timezone
ENV DEBIAN_FRONTEND=noninteractive
ENV TZ=UTC
# Install required dependencies
RUN apt-get update && apt-get install -y \
git \
openjdk-8-jdk \
wget \
unzip \
vim-nox \
tzdata && \
ln -fs /usr/share/zoneinfo/$TZ /etc/localtime && \
dpkg-reconfigure --frontend noninteractive tzdata && \
apt-get clean
# Set up environment variables
ENV ANDROID_SDK_ROOT=/home/user/android
# Install Android SDK
RUN mkdir -p ${ANDROID_SDK_ROOT}/cmdline-tools && \
wget "https://dl.google.com/android/repository/commandlinetools-linux-6609375_latest.zip" -O /tmp/cmdline-tools.zip && \
unzip /tmp/cmdline-tools.zip -d ${ANDROID_SDK_ROOT}/cmdline-tools && \
rm /tmp/cmdline-tools.zip && \
mkdir ${ANDROID_SDK_ROOT}/licenses && \
echo 24333f8a63b6825ea9c5514f83c2829b004d1fee > ${ANDROID_SDK_ROOT}/licenses/android-sdk-license && \
echo 84831b9409646a918e30573bab4c9c91346d8abd > ${ANDROID_SDK_ROOT}/licenses/android-sdk-preview-license && \
yes | ${ANDROID_SDK_ROOT}/cmdline-tools/tools/bin/sdkmanager --install 'emulator' 'system-images;android-24;default;armeabi-v7a'
# Set PATH
ENV PATH=${ANDROID_SDK_ROOT}/cmdline-tools/tools/bin:${ANDROID_SDK_ROOT}/platform-tools:${ANDROID_SDK_ROOT}/emulator:${PATH}
# Create a non-root user
RUN useradd -m user
# Copy the entrypoint script into the Docker image
COPY entrypoint.sh /home/user/entrypoint.sh
# Make the entrypoint script executable
RUN chmod +x /home/user/entrypoint.sh && chown -R user:user /home/user/
# Set the working directory and change to the non-root user
WORKDIR /home/user
USER user
# Set the entrypoint
ENTRYPOINT ["/home/user/entrypoint.sh"]

37
entrypoint.sh 100755
Wyświetl plik

@ -0,0 +1,37 @@
#!/bin/sh
# Set default repository URL
DEFAULT_REPO="https://github.com/ge0rg/aprsdroid.git"
# Use the first argument as the repository URL, or default if not provided
REPO_URL="${1:-$DEFAULT_REPO}"
# Move to the working directory
cd /home/user || exit 1
# Print the current user
whoami
# Clone the repository
echo "Cloning repository: $REPO_URL"
git clone "$REPO_URL" aprsdroid
# Change to the cloned directory
cd aprsdroid/ || exit 1
# Update git submodules
git submodule update --init --recursive
# Set the local.properties file
echo "mapsApiKey=a" > local.properties
# Remove specific lines from build.gradle using sed
sed -i '/id "app.brant.amazonappstorepublisher" version "0.1.0"/d' build.gradle
sed -i '/amazon {/,/}/d' build.gradle
# Run the Gradle assemble task
./gradlew assemble
ls -lathr
# Copy the APK to the mounted volume
cp /home/user/aprsdroid/build/outputs/apk/release/aprsdroid-release-unsigned.apk /home/user/output/aprsdroid-release.apk

Wyświetl plik

@ -116,7 +116,7 @@ class StationListAdapter(context : Context, prefs : PrefsWrapper,
view.findViewById(R.id.station_symbol).asInstanceOf[SymbolView].setSymbol(symbol)
val reportText = if (isWeatherMessage(comment)) parseWXReport(comment) else comment
view.findViewById(R.id.station_report).asInstanceOf[TextView].setText(reportText)
view.findViewById(R.id.listmessage).asInstanceOf[TextView].setText(reportText)
super.bindView(view, context, cursor)
}