# 14.21.3 = 3.14 # 16.20.2 = 3.16 # 18.19.1 = 3.18 # 20.11.1 = 3.19 # 20.15.1 = 3.20 # 22.11.0 = 3.21 ARG REGISTRY_URL=docker.io/aprimediet ARG ALPINE_VERSION=3.21 FROM ${REGISTRY_URL}/alpine:${ALPINE_VERSION} LABEL maintainer=" aprimediet@gmail.com" USER root WORKDIR / # Set Cache Directory ENV NODE_DIR=/usr/local/share/nodejs ENV NPM_CACHE_DIR=${NODE_DIR}/.npm-cache ENV YARN_CACHE_DIR=${NODE_DIR}/.yarn-cache RUN addgroup -g 10001 nodejs && \ adduser -D -u 10001 -G nodejs -s /bin/sh -h /app nodejs # INSTALL WGET AND REQUIRED BUILD TOOLS RUN --mount=type=cache,target=/var/cache/apk \ apk update && apk upgrade && apk add \ nodejs nodejs-dev npm # SET NPM GLOBAL CACHE RUN npm -g config set cache ${NPM_CACHE_DIR} && \ npm config set cache ${NPM_CACHE_DIR} # INSTALL YARN RUN --mount=type=cache,target=${NPM_CACHE_DIR} \ npm i -g yarn # CREATE YARN CACHE DIR RUN mkdir -p ${YARN_CACHE_DIR} # SET YARN CACHE DIR RUN yarn config set cache-folder ${YARN_CACHE_DIR} # CLEAR CACHE RUN apk del curl && \ rm -rf /var/cache/apk/* && \ npm cache clean --force && \ npm -g cache clean --force USER nodejs WORKDIR /app CMD ["node"]