Install NodeJS from package-manager instead of manual download

master
Carlos Gomes 2022-10-04 11:49:28 +02:00
rodzic 0c7a895aa5
commit d425306089
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 870909DFEF7C5FB9
2 zmienionych plików z 43 dodań i 29 usunięć

Wyświetl plik

@ -3,9 +3,9 @@ FROM ubuntu:jammy
LABEL maintainer="Carlos A. Gomes <carlos.algms@gmail.com>"
RUN \
apt update \
&& apt upgrade -y \
&& apt install -y --no-install-recommends \
apt-get update \
&& apt-get upgrade -y \
&& apt-get install -y --no-install-recommends \
apt-transport-https \
curl \
default-mysql-client \
@ -23,9 +23,9 @@ RUN \
xz-utils \
zip \
zsh \
&& apt autoremove -y --purge \
&& apt autoclean -y \
&& apt clean -y \
&& apt-get autoremove -y --purge \
&& apt-get autoclean -y \
&& apt-get clean -y \
&& rm -rf /var/cache/debconf/*-old \
&& rm -rf /usr/share/doc/* \
&& rm -rf /var/lib/apt/lists/* \
@ -35,7 +35,7 @@ RUN \
ARG PHP_VERSION=8.2
RUN \
LC_ALL=C.UTF-8 add-apt-repository -y ppa:ondrej/php \
&& DEBIAN_FRONTEND=noninteractive apt install -y --no-install-recommends \
&& DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
php-pear \
php${PHP_VERSION}-cli \
php${PHP_VERSION}-common \
@ -45,9 +45,9 @@ RUN \
php${PHP_VERSION}-sqlite3 \
php${PHP_VERSION}-xml \
php${PHP_VERSION}-zip \
&& apt autoremove -y --purge \
&& apt autoclean -y \
&& apt clean -y \
&& apt-get autoremove -y --purge \
&& apt-get autoclean -y \
&& apt-get clean -y \
&& rm -rf /var/cache/debconf/*-old \
&& rm -rf /usr/share/doc/* \
&& rm -rf /var/lib/apt/lists/* \
@ -74,27 +74,39 @@ RUN \
# https://docs.docker.com/engine/reference/builder/#automatic-platform-args-in-the-global-scope
ARG TARGETARCH
# ARG TARGETARCH
# Install node, npm and yarn
ARG NODE_VERSION="v16.17.1"
# # Install node, npm and yarn
# ARG NODE_VERSION="v16.17.1"
# RUN \
# if [ "${TARGETARCH}" = "amd64" ]; then \
# ARCHITECTURE=x64; \
# elif [ "${TARGETARCH}" = "arm" ]; then \
# ARCHITECTURE=armv7l; \
# elif [ "${TARGETARCH}" = "arm64" ]; then \
# ARCHITECTURE=arm64; \
# else \
# echo "Unknown TARGETARCH: '${TARGETARCH}'";\
# exit 1; \
# fi \
# && curl -L "https://nodejs.org/dist/${NODE_VERSION}/node-${NODE_VERSION}-linux-${ARCHITECTURE}.tar.xz" \
# --output node.tar.xz \
# && tar xJf node.tar.xz -C /usr --strip-components=1 --no-same-owner \
# && rm node.tar.xz \
# && npm i -g yarn
# https://github.com/nodesource/distributions/blob/master/README.md#installation-instructions
RUN \
if [ "${TARGETARCH}" = "amd64" ]; then \
ARCHITECTURE=x64; \
elif [ "${TARGETARCH}" = "arm" ]; then \
ARCHITECTURE=armv7l; \
elif [ "${TARGETARCH}" = "arm64" ]; then \
ARCHITECTURE=arm64; \
else \
echo "Unknown TARGETARCH: '${TARGETARCH}'";\
exit 1; \
fi \
&& curl -L "https://nodejs.org/dist/${NODE_VERSION}/node-${NODE_VERSION}-linux-${ARCHITECTURE}.tar.xz" \
--output node.tar.xz \
&& tar xJf node.tar.xz -C /usr --strip-components=1 --no-same-owner \
&& rm node.tar.xz \
&& npm i -g yarn
curl -fsSL https://deb.nodesource.com/setup_16.x | bash - \
&& apt-get install -y nodejs \
&& npm i -g yarn \
&& apt-get autoremove -y --purge \
&& apt-get autoclean -y \
&& apt-get clean -y \
&& rm -rf /var/cache/debconf/*-old \
&& rm -rf /usr/share/doc/* \
&& rm -rf /var/lib/apt/lists/* \
&& rm -rf /var/cache/apt/*
COPY zshrc /root/.zshrc

Wyświetl plik

@ -4,6 +4,7 @@ TARGET=Dockerfile
build_8:
docker pull $(IMAGE):php8 || true; \
docker buildx build --rm . \
--load
-f $(TARGET) \
-t $(IMAGE):latest \
-t $(IMAGE):php8
@ -12,6 +13,7 @@ build_8:
build_71:
docker buildx build --rm . \
-f $(TARGET) \
--load \
--build-arg=PHP_VERSION="7.1" \
--build-arg=DEPLOYER_VERSION="v6.6.0" \
--build-arg=COMPOSER_VERSION="2.2.18" \