Skip to content

Commit

Permalink
Move install sdk related RUN commands to shells script (#9)
Browse files Browse the repository at this point in the history
  • Loading branch information
randr0id authored May 21, 2022
1 parent 1df74e2 commit 48d2f2e
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 30 deletions.
4 changes: 1 addition & 3 deletions .github/workflows/checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,7 @@ jobs:
- name: Check out code
uses: actions/checkout@v2
- name: Lint checks
uses: hadolint/[email protected]
with:
dockerfile: Dockerfile
uses: hadolint/[email protected]

build:
name: docker build
Expand Down
37 changes: 10 additions & 27 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -31,48 +31,31 @@ ENV LANG en_US.UTF-8

RUN apt-get update && \
apt-get install --no-install-recommends -y \
apt-utils=2.0.6 \
apt-utils=2.0.8 \
build-essential=12.8ubuntu1.1 \
bzip2=1.0.8-2 \
curl=7.68.0-1ubuntu2.7 \
git=1:2.25.1-1ubuntu3.2 \
curl=7.68.0-1ubuntu2.11 \
git=1:2.25.1-1ubuntu3.4 \
html2text=1.3.2a-25 \
libc6-i386=2.31-0ubuntu9.2 \
libc6-i386=2.31-0ubuntu9.9 \
lib32stdc++6=10.3.0-1ubuntu1~20.04 \
lib32gcc1=1:10.3.0-1ubuntu1~20.04 \
lib32ncurses6=6.2-0ubuntu2 \
lib32z1=1:1.2.11.dfsg-2ubuntu1.2 \
lib32z1=1:1.2.11.dfsg-2ubuntu1.3 \
locales=2.31-0ubuntu9 \
openjdk-11-jdk=11.0.13+8-0ubuntu1~20.04 \
qemu-kvm=1:4.2-3ubuntu6.19 \
openjdk-11-jdk=11.0.15+10-0ubuntu0.20.04.1 \
qemu-kvm=1:4.2-3ubuntu6.21 \
unzip=6.0-25ubuntu1 \
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* \
&& localedef -i en_US -c -f UTF-8 -A /usr/share/locale/locale.alias en_US.UTF-8

RUN locale-gen
RUN locale-gen && rm -f /var/lib/dpkg/info/ca-certificates-java.postinst configure

RUN rm -f /var/lib/dpkg/info/ca-certificates-java.postinst configure

RUN curl -s https://dl.google.com/android/repository/commandlinetools-linux-${VERSION_TOOLS}_latest.zip > /tools.zip && \
unzip /tools.zip -d ${ANDROID_HOME} && \
rm -v /tools.zip

RUN mkdir -p ${ANDROID_HOME}/licenses/ && \
printf "8933bad161af4178b1185d1a37fbf41ea5269c55\\nd56f5187479451eabf01fb78af6dfcb131a6481e\\n24333f8a63b6825ea9c5514f83c2829b004d1fee" > ${ANDROID_HOME}/licenses/android-sdk-license && \
printf "84831b9409646a918e30573bab4c9c91346d8abd\\n504667f4c0de7af1a06de9f4b1727b84351f2910" > ${ANDROID_HOME}/licenses/android-sdk-preview-license

RUN yes | ${ANDROID_TOOLS}/bin/sdkmanager --sdk_root=${ANDROID_HOME} --licenses

RUN mkdir -p /root/.android && \
touch /root/.android/repositories.cfg && \
${ANDROID_TOOLS}/bin/sdkmanager --sdk_root=${ANDROID_HOME} --update
RUN mkdir -p ${ANDROID_HOME} && chmod +070 ${ANDROID_HOME}

COPY packages.txt ${ANDROID_HOME}
RUN while read -r package; do PACKAGES="${PACKAGES}${package} "; done < /sdk/packages.txt && \
${ANDROID_TOOLS}/bin/sdkmanager --sdk_root=${ANDROID_HOME} ${PACKAGES}

COPY utils ${ANDROID_HOME}/utils

RUN chmod +070 ${ANDROID_HOME}
RUN ${ANDROID_HOME}/utils/install-android-sdk.sh

WORKDIR /work
17 changes: 17 additions & 0 deletions utils/install-android-sdk.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
curl -s https://dl.google.com/android/repository/commandlinetools-linux-${VERSION_TOOLS}_latest.zip > /tools.zip && \
unzip /tools.zip -d ${ANDROID_HOME} && \
rm -v /tools.zip

mkdir -p ${ANDROID_HOME}/licenses/ && \
printf "8933bad161af4178b1185d1a37fbf41ea5269c55\\nd56f5187479451eabf01fb78af6dfcb131a6481e\\n24333f8a63b6825ea9c5514f83c2829b004d1fee" > ${ANDROID_HOME}/licenses/android-sdk-license && \
printf "84831b9409646a918e30573bab4c9c91346d8abd\\n504667f4c0de7af1a06de9f4b1727b84351f2910" > ${ANDROID_HOME}/licenses/android-sdk-preview-license

yes | ${ANDROID_TOOLS}/bin/sdkmanager --sdk_root=${ANDROID_HOME} --licenses

mkdir -p /root/.android && \
touch /root/.android/repositories.cfg && \
${ANDROID_TOOLS}/bin/sdkmanager --sdk_root=${ANDROID_HOME} --update

while read -r package; do PACKAGES="${PACKAGES}${package} "; done < /sdk/packages.txt && \
${ANDROID_TOOLS}/bin/sdkmanager --sdk_root=${ANDROID_HOME} ${PACKAGES}

0 comments on commit 48d2f2e

Please sign in to comment.