63 lines
1.8 KiB
Docker
63 lines
1.8 KiB
Docker
# 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 OS_VERSION=3.21
|
|
|
|
FROM quay.io/sindigilive/alpine:${OS_VERSION} AS builder
|
|
|
|
USER root
|
|
WORKDIR /tmp
|
|
|
|
# Add nginx user and group and install required nvm installer
|
|
RUN /sbin/apk add --update --no-cache \
|
|
nodejs nodejs-dev npm ;
|
|
|
|
FROM scratch
|
|
|
|
ARG NODE_VERSION=22.11.0
|
|
ARG NODE_VER_SHORT=22
|
|
|
|
|
|
ENV NODE_VERSION=${NODE_VERSION}
|
|
ENV NODE_VER_SHORT=${NODE_VER_SHORT}
|
|
ENV APP_ROOT_DIR=/app
|
|
ENV APP_DIR=${APP_ROOT_DIR}/htdocs
|
|
ENV NPM_CACHE_DIR=${APP_ROOT_DIR}/.npm-cache
|
|
ENV YARN_CACHE_DIR=${APP_ROOT_DIR}/.yarn-cache
|
|
|
|
LABEL maintainer="Muhamad Aditya Prima <map@sindigilive.com>"
|
|
LABEL name="nginx"
|
|
LABEL version="${NODE_VERSION}"
|
|
LABEL distribution-scope="public"
|
|
|
|
#labels for container catalog
|
|
LABEL summary="Nginx ${NODE_VERSION} on alpine based container image"
|
|
LABEL description="Provide nginx on alpine based container base image"
|
|
LABEL io.k8s.description="Very small alpine linux container image"
|
|
LABEL io.k8s.display-name="Nginx ${NODE_VERSION}"
|
|
|
|
COPY --from=builder / /
|
|
|
|
# Setup user and directories
|
|
RUN /bin/mkdir -p ${APP_DIR} ${NPM_CACHE_DIR} ${YARN_CACHE_DIR} ; \
|
|
/usr/sbin/addgroup -g 10001 nodejs ; \
|
|
/usr/sbin/adduser -D -u 10001 -G nodejs -s /sbin/nologin -h ${APP_ROOT_DIR} nodejs ; \
|
|
/bin/chown -R nodejs:nodejs ${APP_ROOT_DIR} ; \
|
|
/usr/sbin/addgroup -g 10001 nodejs ; \
|
|
/usr/sbin/adduser -D -u 10001 -G nodejs -s /sbin/nologin -h ${APP_DIR} nodejs ; \
|
|
/usr/bin/npm -g config set cache ${NPM_CACHE_DIR} ; \
|
|
/usr/bin/npm config set cache ${NPM_CACHE_DIR} ; \
|
|
/usr/bin/npm i -g yarn ; \
|
|
/usr/local/bin/yarn config set cache-folder ${YARN_CACHE_DIR} ; \
|
|
/bin/rm -rf /var/cache/apk/* ; \
|
|
/usr/bin/npm cache clean --force ; \
|
|
/usr/bin/npm -g cache clean --force ;
|
|
|
|
USER nodejs
|
|
|
|
WORKDIR ${APP_DIR}
|
|
|
|
CMD ["/usr/bin/node", "-v"] |