From 65c0f12c1c5ec08907db63466172cd762a705efe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jovan=20Kruni=C4=87?= Date: Thu, 4 Feb 2021 21:28:26 +0100 Subject: [PATCH] build: optimize the Dockerfile --- Dockerfile | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/Dockerfile b/Dockerfile index 69a8f2e4..e0ad8bc2 100644 --- a/Dockerfile +++ b/Dockerfile @@ -24,12 +24,6 @@ ENV ANDROID_APIS="android-26" \ ### Set $PATH ENV PATH=$ANDROID_HOME/tools:$ANDROID_HOME/tools/bin:$ANDROID_HOME/platform-tools:$ANDROID_HOME/build-tools/$ANDROID_BUILD_TOOLS_VERSION:$PATH -### Set working directory -WORKDIR /app - -### Add contents to working directory -ADD . /app - ### Replace shell with bash RUN rm /bin/sh && ln -s /bin/bash /bin/sh && \ ### Set debconf to run non-interactively @@ -84,15 +78,6 @@ RUN apt-get update -y && \ RUN rm /etc/ssl/certs/java/cacerts && \ update-ca-certificates -f -### Copy scripts directory into the tmp folder, so it's available to the following commands -COPY $SCRIPTS_DIRECTORY/$NODE_SETUP_SCRIPT /tmp/ - -RUN bash /tmp/$NODE_SETUP_SCRIPT && apt-get install -y nodejs && \ - ### Update npm to latest version - npm install -g npm@$NPM_VERSION && \ - ### Install needed npm packages - npm install -g @ionic/cli@$IONIC_VERSION cordova@$CORDOVA_VERSION - ### Install android RUN curl $ANDROID_SDK_TOOLS_DOWNLOAD_URL > /tmp/android-sdk.zip && \ unzip /tmp/android-sdk.zip && \ @@ -103,6 +88,21 @@ RUN curl $ANDROID_SDK_TOOLS_DOWNLOAD_URL > /tmp/android-sdk.zip && \ ### Install platform tools sdkmanager "platforms;$ANDROID_APIS" "build-tools;$ANDROID_BUILD_TOOLS_VERSION" +### Set working directory +WORKDIR /app + +### Add contents to working directory +ADD . /app + +### Copy scripts directory into the tmp folder, so it's available to the following commands +COPY $SCRIPTS_DIRECTORY/$NODE_SETUP_SCRIPT /tmp/ + +RUN bash /tmp/$NODE_SETUP_SCRIPT && apt-get install -y nodejs && \ + ### Update npm to latest version + npm install -g npm@$NPM_VERSION && \ + ### Install needed npm packages + npm install -g @ionic/cli@$IONIC_VERSION cordova@$CORDOVA_VERSION + ### Create, build, delete an empty cordova project to download necessary maven files and keep them in image RUN cordova create tmp-project && \ cd tmp-project && \