dockerfile: consolidate multiple RUN statements
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
..to achieve faster builds
This commit is contained in:
parent
8f6fdd8b0d
commit
5263bfaa8f
48
Dockerfile
48
Dockerfile
@ -19,32 +19,32 @@ ENV VERSION_TOOLS "6609375"
|
|||||||
ENV ANDROID_HOME "/tmp/sdk"
|
ENV ANDROID_HOME "/tmp/sdk"
|
||||||
ENV ANDROID_SDK_ROOT "${ANDROID_HOME}"
|
ENV ANDROID_SDK_ROOT "${ANDROID_HOME}"
|
||||||
|
|
||||||
RUN apk update
|
|
||||||
RUN apk add --no-cache binutils ca-certificates curl git openssl unzip --repository=http://dl-cdn.alpinelinux.org/alpine/edge/testing
|
|
||||||
|
|
||||||
WORKDIR /tmp
|
WORKDIR /tmp
|
||||||
RUN curl -o sdk.zip -s https://dl.google.com/android/repository/sdk-tools-linux-"${VERSION_SDK_TOOLS}".zip
|
RUN apk update && \
|
||||||
RUN unzip ./sdk.zip -d "${ANDROID_HOME}"
|
apk add --no-cache binutils ca-certificates curl git openssl unzip --repository=http://dl-cdn.alpinelinux.org/alpine/edge/testing && \
|
||||||
RUN rm -f ./sdk.zip
|
\
|
||||||
|
curl -o sdk.zip -s https://dl.google.com/android/repository/sdk-tools-linux-"${VERSION_SDK_TOOLS}".zip && \
|
||||||
RUN curl -o tools.zip -s https://dl.google.com/android/repository/commandlinetools-linux-"${VERSION_TOOLS}"_latest.zip \
|
unzip ./sdk.zip -d "${ANDROID_HOME}" && \
|
||||||
|
rm -f ./sdk.zip && \
|
||||||
|
\
|
||||||
|
curl -o tools.zip -s https://dl.google.com/android/repository/commandlinetools-linux-"${VERSION_TOOLS}"_latest.zip \
|
||||||
&& mkdir -p "${ANDROID_HOME}"/cmdline-tools \
|
&& mkdir -p "${ANDROID_HOME}"/cmdline-tools \
|
||||||
&& unzip ./tools.zip -d "${ANDROID_HOME}"/cmdline-tools \
|
&& unzip ./tools.zip -d "${ANDROID_HOME}"/cmdline-tools \
|
||||||
&& rm -v ./tools.zip
|
&& rm -v ./tools.zip && \
|
||||||
|
\
|
||||||
RUN mkdir -p $ANDROID_HOME/licenses/ \
|
mkdir -p $ANDROID_HOME/licenses/ \
|
||||||
&& echo "8933bad161af4178b1185d1a37fbf41ea5269c55\nd56f5187479451eabf01fb78af6dfcb131a6481e\n24333f8a63b6825ea9c5514f83c2829b004d1fee" > $ANDROID_HOME/licenses/android-sdk-license \
|
&& echo "8933bad161af4178b1185d1a37fbf41ea5269c55\nd56f5187479451eabf01fb78af6dfcb131a6481e\n24333f8a63b6825ea9c5514f83c2829b004d1fee" > $ANDROID_HOME/licenses/android-sdk-license \
|
||||||
&& echo "84831b9409646a918e30573bab4c9c91346d8abd\n504667f4c0de7af1a06de9f4b1727b84351f2910" > $ANDROID_HOME/licenses/android-sdk-preview-license \
|
&& echo "84831b9409646a918e30573bab4c9c91346d8abd\n504667f4c0de7af1a06de9f4b1727b84351f2910" > $ANDROID_HOME/licenses/android-sdk-preview-license \
|
||||||
&& yes | ${ANDROID_HOME}/cmdline-tools/tools/bin/sdkmanager --sdk_root=${ANDROID_HOME} --licenses >/dev/null
|
&& yes | ${ANDROID_HOME}/cmdline-tools/tools/bin/sdkmanager --sdk_root=${ANDROID_HOME} --licenses >/dev/null
|
||||||
|
|
||||||
COPY packages.txt "${ANDROID_HOME}"
|
COPY packages.txt "${ANDROID_HOME}"
|
||||||
RUN mkdir -p /"$(whoami)"/.android
|
RUN mkdir -p /"$(whoami)"/.android && \
|
||||||
RUN touch /"$(whoami)"/.android/repositories.cfg
|
touch /"$(whoami)"/.android/repositories.cfg && \
|
||||||
|
\
|
||||||
RUN yes | "${ANDROID_HOME}"/tools/bin/sdkmanager --verbose --licenses
|
yes | "${ANDROID_HOME}"/tools/bin/sdkmanager --verbose --licenses && \
|
||||||
RUN "${ANDROID_HOME}"/tools/bin/sdkmanager --verbose --update
|
"${ANDROID_HOME}"/tools/bin/sdkmanager --verbose --update && \
|
||||||
|
\
|
||||||
RUN while read -r package; do PACKAGES="${PACKAGES}${package} "; done < "${ANDROID_HOME}"/packages.txt && ${ANDROID_HOME}/tools/bin/sdkmanager --verbose ${PACKAGES}
|
while read -r package; do PACKAGES="${PACKAGES}${package} "; done < "${ANDROID_HOME}"/packages.txt && ${ANDROID_HOME}/tools/bin/sdkmanager --verbose ${PACKAGES}
|
||||||
|
|
||||||
FROM adoptopenjdk/openjdk11:alpine-slim
|
FROM adoptopenjdk/openjdk11:alpine-slim
|
||||||
COPY --from=build /tmp/sdk /sdk
|
COPY --from=build /tmp/sdk /sdk
|
||||||
@ -58,19 +58,17 @@ ENV PATH "$PATH:${ANDROID_HOME}/tools"
|
|||||||
ENV ASDF_VERSION "v0.8.1"
|
ENV ASDF_VERSION "v0.8.1"
|
||||||
ENV GRADLE_VERSION "7.1"
|
ENV GRADLE_VERSION "7.1"
|
||||||
|
|
||||||
RUN apk add --no-cache bash curl git vim xz --repository=http://dl-cdn.alpinelinux.org/alpine/edge/testing
|
RUN apk add --no-cache bash curl git vim xz --repository=http://dl-cdn.alpinelinux.org/alpine/edge/testing \
|
||||||
|
&& git clone https://github.com/asdf-vm/asdf.git ~/.asdf --branch "${ASDF_VERSION}" \
|
||||||
# gradle pls
|
|
||||||
RUN git clone https://github.com/asdf-vm/asdf.git ~/.asdf --branch "${ASDF_VERSION}" \
|
|
||||||
&& sed -i 's/\/bin\/ash/\/bin\/bash/' /etc/passwd && cat /etc/passwd \
|
&& sed -i 's/\/bin\/ash/\/bin\/bash/' /etc/passwd && cat /etc/passwd \
|
||||||
&& echo -e '\n. $HOME/.asdf/asdf.sh' >> ~/.bashrc \
|
&& echo -e '\n. $HOME/.asdf/asdf.sh' >> ~/.bashrc \
|
||||||
&& echo -e '\n. $HOME/.asdf/completions/asdf.bash' >> ~/.bashrc \
|
&& echo -e '\n. $HOME/.asdf/completions/asdf.bash' >> ~/.bashrc \
|
||||||
&& bash -c ". ~/.bashrc; ~/.asdf/bin/asdf plugin-add gradle https://github.com/rfrancis/asdf-gradle.git" \
|
&& bash -c ". ~/.bashrc; ~/.asdf/bin/asdf plugin-add gradle https://github.com/rfrancis/asdf-gradle.git" \
|
||||||
&& bash -c ". ~/.bashrc; ~/.asdf/bin/asdf install gradle ${GRADLE_VERSION}" \
|
&& bash -c ". ~/.bashrc; ~/.asdf/bin/asdf install gradle ${GRADLE_VERSION}" \
|
||||||
&& bash -c ". ~/.bashrc; ~/.asdf/bin/asdf global gradle ${GRADLE_VERSION}" \
|
&& bash -c ". ~/.bashrc; ~/.asdf/bin/asdf global gradle ${GRADLE_VERSION}" \
|
||||||
&& bash -c ". ~/.bashrc; ~/.asdf/shims/gradle --version"
|
&& bash -c ". ~/.bashrc; ~/.asdf/shims/gradle --version" && \
|
||||||
|
\
|
||||||
RUN ln -svf /bin/bash /bin/sh \
|
ln -svf /bin/bash /bin/sh \
|
||||||
&& ls -la /bin/*sh \
|
&& ls -la /bin/*sh \
|
||||||
&& echo -e "\n. ~/.bashrc" >> ~/.bash_profile
|
&& echo -e "\n. ~/.bashrc" >> ~/.bash_profile
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user