mirror of
https://github.com/vide/matedroid.git
synced 2026-01-20 00:03:17 +08:00
e300a37884
- Add Dockerfile.test for containerized test execution - Add .dockerignore to optimize Docker build context - Add 'make test-docker' target for running tests in Docker This enables running the test suite in a Kubernetes cluster. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
51 lines
1.6 KiB
Docker
51 lines
1.6 KiB
Docker
# Dockerfile for running Android unit tests
|
|
# Usage: docker build -f Dockerfile.test -t matedroid-test . && docker run --rm matedroid-test
|
|
|
|
FROM eclipse-temurin:17-jdk-jammy
|
|
|
|
# Set environment variables
|
|
ENV ANDROID_HOME=/opt/android-sdk
|
|
ENV ANDROID_SDK_ROOT=${ANDROID_HOME}
|
|
ENV PATH=${PATH}:${ANDROID_HOME}/cmdline-tools/latest/bin:${ANDROID_HOME}/platform-tools
|
|
|
|
# Install dependencies
|
|
RUN apt-get update && apt-get install -y --no-install-recommends \
|
|
wget \
|
|
unzip \
|
|
git \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
# Download and install Android command line tools
|
|
RUN mkdir -p ${ANDROID_HOME}/cmdline-tools && \
|
|
wget -q https://dl.google.com/android/repository/commandlinetools-linux-11076708_latest.zip -O /tmp/cmdline-tools.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
|
|
|
|
# Accept licenses and install required SDK components
|
|
RUN yes | sdkmanager --licenses && \
|
|
sdkmanager "platform-tools" "platforms;android-34" "build-tools;34.0.0"
|
|
|
|
# Create working directory
|
|
WORKDIR /app
|
|
|
|
# Copy gradle wrapper first for caching
|
|
COPY gradle gradle
|
|
COPY gradlew .
|
|
COPY gradlew.bat .
|
|
COPY gradle.properties .
|
|
COPY build.gradle.kts .
|
|
COPY settings.gradle.kts .
|
|
|
|
# Make gradlew executable
|
|
RUN chmod +x gradlew
|
|
|
|
# Download gradle dependencies (cached layer)
|
|
RUN ./gradlew --no-daemon dependencies || true
|
|
|
|
# Copy the rest of the project
|
|
COPY . .
|
|
|
|
# Default command: run unit tests
|
|
CMD ["./gradlew", "--no-daemon", "testDebugUnitTest"]
|