From 389e55866169e52636b31665568383a77a0f670a Mon Sep 17 00:00:00 2001 From: Oguz Kocer Date: Wed, 9 Mar 2022 18:11:00 -0500 Subject: [PATCH 1/6] Add node --- Dockerfile | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index b75cd05..cde733d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -3,9 +3,13 @@ FROM debian:stable RUN rm /bin/sh && ln -s /bin/bash /bin/sh +# Increase the file watcher limit for node. This should not be necessary for CI builds since watchers should be disabled, but it can be useful when running this image in a local environment. +RUN echo fs.inotify.max_user_watches=524288 | tee -a /etc/sysctl.conf + # Install system commands, Android SDK, and Ruby RUN apt-get update \ && apt-get install -y coreutils git wget locales android-sdk android-sdk-build-tools \ + && apt-get install -y curl git php-cli php-mbstring \ && apt-get -y autoclean # Set up the default locale @@ -47,4 +51,8 @@ RUN mkdir gradle-cache-tmp \ && gradle-8.2.1/bin/gradle wrapper --gradle-version 8.2.1 --distribution-type all \ && ./gradlew \ && cd .. \ - && rm -rf ./gradle-cache-tmp \ + && rm -rf ./gradle-cache-tmp + +SHELL ["/bin/bash", "--login", "-c"] +RUN curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.3/install.sh | bash +RUN nvm install lts/* From ed6281e2446013b03bc78b1e0f80c9c466a54c6c Mon Sep 17 00:00:00 2001 From: Wojtek Zieba Date: Fri, 2 Feb 2024 16:10:56 +0100 Subject: [PATCH 2/6] Do not install `android-sdk` and `android-sdk-build-tools` Those packages seems to be broken via apt-get. Also, we install them via `sdkmanager` in next steps. --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index cde733d..f52845d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -8,7 +8,7 @@ RUN echo fs.inotify.max_user_watches=524288 | tee -a /etc/sysctl.conf # Install system commands, Android SDK, and Ruby RUN apt-get update \ - && apt-get install -y coreutils git wget locales android-sdk android-sdk-build-tools \ + && apt-get install -y coreutils git wget locales \ && apt-get install -y curl git php-cli php-mbstring \ && apt-get -y autoclean From 120e1147fd01177ab97e09dadf8d6b3b1377c398 Mon Sep 17 00:00:00 2001 From: Wojtek Zieba Date: Fri, 2 Feb 2024 16:13:57 +0100 Subject: [PATCH 3/6] Update `commandlinetools` to `linux-11076708` --- Dockerfile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index f52845d..f4d6f4a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -19,9 +19,9 @@ ENV ANDROID_HOME=/usr/lib/android-sdk ENV GRADLE_OPTS="-Xmx6G -XX:+HeapDumpOnOutOfMemoryError -Dorg.gradle.caching=true -Dorg.gradle.configureondemand=true -Dkotlin.compiler.execution.strategy=in-process -Dkotlin.incremental=false" # Download the SDK Manager -RUN wget https://dl.google.com/android/repository/commandlinetools-linux-6858069_latest.zip \ - && unzip commandlinetools-linux-6858069_latest.zip && rm commandlinetools-linux-6858069_latest.zip \ - && mkdir /usr/lib/android-sdk/cmdline-tools \ +RUN wget https://dl.google.com/android/repository/commandlinetools-linux-11076708_latest.zip \ + && unzip commandlinetools-linux-11076708_latest.zip && rm commandlinetools-linux-11076708_latest.zip \ + && mkdir -p /usr/lib/android-sdk/cmdline-tools \ && mv cmdline-tools /usr/lib/android-sdk/cmdline-tools/latest ENV PATH="//usr/lib/android-sdk/cmdline-tools/latest/bin:${PATH}" From 3f526e4f33e430308e8d82cbe33668d0c3109f50 Mon Sep 17 00:00:00 2001 From: Wojtek Zieba Date: Fri, 2 Feb 2024 16:15:05 +0100 Subject: [PATCH 4/6] Use `gradle:8.2.1-jdk17` image It has preinstalled JDK17 (which was problematic to install on Debian). Also, we don't have to cache Gradle because it's preinstalled. --- Dockerfile | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/Dockerfile b/Dockerfile index f4d6f4a..007c6b2 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,5 @@ # syntax=docker/dockerfile:1 -FROM debian:stable +FROM gradle:8.2.1-jdk17 RUN rm /bin/sh && ln -s /bin/bash /bin/sh @@ -42,17 +42,6 @@ RUN mkdir scripts COPY scripts/ scripts/ ENV PATH="/scripts/:${PATH}" -# Cache Gradle 8.2.1 -RUN mkdir gradle-cache-tmp \ - && cd gradle-cache-tmp \ - && wget https://services.gradle.org/distributions/gradle-8.2.1-bin.zip \ - && unzip gradle-8.2.1-bin.zip \ - && touch settings.gradle \ - && gradle-8.2.1/bin/gradle wrapper --gradle-version 8.2.1 --distribution-type all \ - && ./gradlew \ - && cd .. \ - && rm -rf ./gradle-cache-tmp - SHELL ["/bin/bash", "--login", "-c"] RUN curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.3/install.sh | bash RUN nvm install lts/* From d60763dc78dfafe152e1539453a480af5094a0e7 Mon Sep 17 00:00:00 2001 From: Wojtek Zieba Date: Fri, 2 Feb 2024 16:15:32 +0100 Subject: [PATCH 5/6] Fix NVM installation I'm not sure how it was working previously, but now it was failing with `nvm command not found` --- Dockerfile | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 007c6b2..fdc1257 100644 --- a/Dockerfile +++ b/Dockerfile @@ -44,4 +44,6 @@ ENV PATH="/scripts/:${PATH}" SHELL ["/bin/bash", "--login", "-c"] RUN curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.3/install.sh | bash -RUN nvm install lts/* +RUN export NVM_DIR="$HOME/.nvm" \ + && [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" \ + && nvm install lts/* From 9d1710c7d74d1349d84e94465fe7b3a90216e92a Mon Sep 17 00:00:00 2001 From: Wojtek Zieba Date: Fri, 2 Feb 2024 19:54:51 +0100 Subject: [PATCH 6/6] Add `npm` to `PATH` --- Dockerfile | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/Dockerfile b/Dockerfile index fdc1257..71aba8f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -43,7 +43,10 @@ COPY scripts/ scripts/ ENV PATH="/scripts/:${PATH}" SHELL ["/bin/bash", "--login", "-c"] -RUN curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.3/install.sh | bash -RUN export NVM_DIR="$HOME/.nvm" \ - && [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" \ - && nvm install lts/* +ENV NODE_VERSION v20.11.0 +RUN curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash \ + && source "$HOME/.nvm/nvm.sh" \ + && nvm install $NODE_VERSION +ENV PATH="//root/.nvm/versions/node/$NODE_VERSION/bin:${PATH}" + +RUN which npm