# 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 ARG REGISTRY_URL=git.winteraccess.id/docker ARG ALPINE_VERSION=3.20 FROM ${REGISTRY_URL}/alpine:${ALPINE_VERSION} LABEL maintainer=" aprimediet@gmail.com" WORKDIR / # ADD USER RUN addgroup -g 1001 node && adduser -D -u 1001 -G node -s /bin/bash -h /app node # SET CACHE DIR ENV NODE_DIR=/usr/local/share/nodejs ENV NPM_CACHE_DIR=${NODE_DIR}/.npm-cache ENV YARN_CACHE_DIR=${NODE_DIR}/.yarn-cache # 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 # SET AS USER NODE WORKDIR /app USER node