From 0fd783e65e7941c95a8d88abb4681d9e6506cf5e Mon Sep 17 00:00:00 2001 From: Andrey Antukh Date: Tue, 22 Oct 2024 17:52:42 +0200 Subject: [PATCH] :sparkles: Make nodejs available on backend docker image Used for execute svgo-cli.js script --- docker/images/Dockerfile.backend | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/docker/images/Dockerfile.backend b/docker/images/Dockerfile.backend index c68e5181c..7f046806b 100644 --- a/docker/images/Dockerfile.backend +++ b/docker/images/Dockerfile.backend @@ -4,8 +4,9 @@ LABEL maintainer="Penpot " ENV LANG='en_US.UTF-8' \ LC_ALL='en_US.UTF-8' \ JAVA_HOME="/opt/jdk" \ - PATH=/opt/jdk/bin:$PATH \ + PATH=/opt/jdk/bin:/opt/node/bin:$PATH \ DEBIAN_FRONTEND=noninteractive \ + NODE_VERSION=v20.18.0 \ TZ=Etc/UTC RUN set -ex; \ @@ -36,6 +37,27 @@ RUN set -ex; \ chown -R penpot:penpot /opt/data; \ rm -rf /var/lib/apt/lists/*; +RUN set -eux; \ + ARCH="$(dpkg --print-architecture)"; \ + case "${ARCH}" in \ + aarch64|arm64) \ + BINARY_URL="https://nodejs.org/dist/${NODE_VERSION}/node-${NODE_VERSION}-linux-arm64.tar.gz"; \ + ;; \ + amd64|x86_64) \ + BINARY_URL="https://nodejs.org/dist/${NODE_VERSION}/node-${NODE_VERSION}-linux-x64.tar.gz"; \ + ;; \ + *) \ + echo "Unsupported arch: ${ARCH}"; \ + exit 1; \ + ;; \ + esac; \ + curl -LfsSo /tmp/nodejs.tar.gz ${BINARY_URL}; \ + mkdir -p /opt/node; \ + cd /opt/node; \ + tar -xf /tmp/nodejs.tar.gz --strip-components=1; \ + chown -R root /opt/node; \ + rm -rf /tmp/nodejs.tar.gz; + RUN set -eux; \ ARCH="$(dpkg --print-architecture)"; \ case "${ARCH}" in \