nodesource / distributions

NodeSource Node.js Binary Distributions
https://nodesource.com
MIT License
13.51k stars 3.07k forks source link

name: no package provides redhat-release #1571

Closed eluricharter closed 1 year ago

eluricharter commented 1 year ago

Here is my Dockerfile

FROM amazonlinux:latest

Install Git / Github (used by npm, yarn, etc)

RUN yum install -y git sudo RUN yum install -y wget sudo RUN mkdir -p ~/.ssh && \ ssh-keyscan github.com | tee ~/.ssh/known_hosts && \ chmod 640 ~/.ssh/known_hosts

Install NodeJS 10 LTS + NPM

RUN wget -qO- https://rpm.nodesource.com/setup_10.x | sudo bash - RUN yum --enablerepo=nodesource info nodejs RUN yum --enablerepo=nodesource install -y nodejs

Install Yarn (an alternative to NPM)

RUN sudo curl -s -o /etc/yum.repos.d/yarn.repo https://dl.yarnpkg.com/rpm/yarn.repo RUN yum --enablerepo=yarn install -y yarn

Install Global NPM dependencies

RUN npm install pm2 yo -g && npm cache clean

RUN if [[ -f yarn.lock ]]; then yarn --ignore-engines; fi RUN if [[ ! -f yarn.lock ]]; then npm install pm2 yo -g; npm cache clean --force; fi

Install Clean up

RUN yum clean all && \ rm -rf /var/cache/yum/ && \ rm -rf /tmp/ && \ rm -rf /var/tmp/*

Prepare workspace

RUN mkdir -p /usr/src/app WORKDIR /usr/src/app

Set user/group IDs

RUN useradd -rU -d /usr/src/app -c "NodeJS User" node && \ echo "node ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers && \ chown -R node:node /usr/src/app

USER node

Configure NPM Register (Charter)

RUN echo 'registry=https://artifactory.se-charter.net/artifactory/api/npm/npm/' > ~/.npmrc

Downstream ENV

ONBUILD ARG CLOUD_APP ONBUILD ENV CLOUD_APP ${CLOUD_APP} ONBUILD ARG CLOUD_ENVIRONMENT ONBUILD ENV CLOUD_ENVIRONMENT ${CLOUD_ENVIRONMENT} ONBUILD ARG CLOUD_STACK ONBUILD ENV CLOUD_STACK ${CLOUD_STACK:-cnet} ONBUILD ARG CLOUD_DOMAIN ONBUILD ENV CLOUD_DOMAIN ${CLOUD_DOMAIN} ONBUILD ARG CLOUD_DEV_PHASE ONBUILD ENV CLOUD_DEV_PHASE ${CLOUD_DEV_PHASE} ONBUILD ARG CLOUD_REVISION ONBUILD ENV CLOUD_REVISION ${CLOUD_REVISION} ONBUILD ARG CLOUD_CLUSTER ONBUILD ENV CLOUD_CLUSTER ${CLOUD_CLUSTER} ONBUILD ARG CLOUD_AUTO_SCALE_GROUP ONBUILD ENV CLOUD_AUTO_SCALE_GROUP ${CLOUD_AUTO_SCALE_GROUP} ONBUILD ARG CLOUD_HARDWARE ONBUILD ENV CLOUD_HARDWARE ${CLOUD_HARDWARE} ONBUILD ARG CLOUD_PARTNERS ONBUILD ENV CLOUD_PARTNERS ${CLOUD_PARTNERS} ONBUILD ARG CLOUD_DEV_PHASE ONBUILD ENV CLOUD_DEV_PHASE ${CLOUD_DEV_PHASE} ONBUILD ARG EC2_REGION ONBUILD ENV EC2_REGION ${EC2_REGION} ONBUILD ARG ASGARD_OPTS ONBUILD ENV ASGARD_OPTS ${ASGARD_OPTS} ONBUILD ARG instanceid ONBUILD ENV instanceid ${instanceid} ONBUILD ARG privip ONBUILD ENV privip ${privip} ONBUILD ARG vpc_id ONBUILD ENV vpc_id ${vpc_id} ONBUILD ARG NODE_ENV ONBUILD ENV NODE_ENV ${NODE_ENV:-production} ONBUILD ARG HOST ONBUILD ENV HOST ${HOST:-0.0.0.0} ONBUILD ARG PORT ONBUILD ENV PORT ${PORT:-3000} ENV NODE_ENV production

COPY --chown=node:node . /usr/src/app/

RUN yarn install --ignore-engines RUN npm build

Downstream dependency install

ONBUILD USER root

ONBUILD COPY --chown=node:node . /usr/src/app/

ONBUILD USER node

for-loop purges kubernetes service discovery parameters because there are too many of them

CMD ["sh", "-c", "for i in $(set | grep -E 'SERVICE|_PORT' | cut -f1 -d=); do unset $i; done; pm2-docker start --env production process.yml"]

Seeing this error could someone please help

INFO[0031] Taking snapshot of full filesystem...
INFO[0032] RUN wget -qO- https://rpm.nodesource.com/setup_16.x | sudo bash - INFO[0032] cmd: /bin/sh
INFO[0032] args: [-c wget -qO- https://rpm.nodesource.com/setup_16.x | sudo bash -] INFO[0032] Running: [/bin/sh -c wget -qO- https://rpm.nodesource.com/setup_16.x | sudo bash -]

Installing the NodeSource Node.js 16.x repo...

Inspecting system...

riosje commented 1 year ago

Please complete the information of the issue, otherwise it will be closed.

Describe your bug A clear and concise description of what the bug is.

Distribution Information:

OS: [e.g. Ubuntu] Version [e.g. focal (20.04)] Other info if applicable [e.g. Docker image XXX, AWS AMI ID] Node Version:

Node: [e.g. Node.js v18.x:] To Reproduce Steps to reproduce the behavior:

Execute Ubuntu Docker Image XX Execute Installation instructions for Node.js v1x.x: .... Expected behavior A clear and concise description of what you expected to happen.

Screenshots If applicable, add screenshots to help explain your problem.

Additional context Add any other context about the problem here, specify if already has another NodeJS version or if trying to re-install the current version.

eluricharter commented 1 year ago

Here is my Dockerfile

Please complete the information of the issue, otherwise it will be closed.

Describe your bug A clear and concise description of what the bug is.

Distribution Information:

OS: [e.g. Ubuntu] Version [e.g. focal (20.04)] Other info if applicable [e.g. Docker image XXX, AWS AMI ID] Node Version:

Node: [e.g. Node.js v18.x:] To Reproduce Steps to reproduce the behavior:

Execute Ubuntu Docker Image XX Execute Installation instructions for Node.js v1x.x: .... Expected behavior A clear and concise description of what you expected to happen.

Screenshots If applicable, add screenshots to help explain your problem.

Additional context Add any other context about the problem here, specify if already has another NodeJS version or if trying to re-install the current version.

i have updated my issue

riosje commented 1 year ago

there is not support for Node10 for Amazon linux 2023. For the latest version of amazon linux we only support from Node18 and latests versions.

this replacing this

RUN wget -qO- https://rpm.nodesource.com/setup_10.x | sudo bash -

for this one

RUN wget -qO- https://rpm.nodesource.com/setup_18.x | sudo bash -
eluricharter commented 1 year ago

there is not support for Node10 for Amazon linux 2023. For the latest version of amazon linux we only support from Node18 and latests versions.

this replacing this

RUN wget -qO- https://rpm.nodesource.com/setup_10.x | sudo bash -

for this one

RUN wget -qO- https://rpm.nodesource.com/setup_18.x | sudo bash -

after upgrading to RUN wget -qO- https://rpm.nodesource.com/setup_18.x | sudo bash - seeing below error now

INFO[0167] args: [-c npm build]
INFO[0167] util.Lookup returned: &{Uid:999 Gid:998 Username:node Name:NodeJS User HomeDir:/usr/src/app} INFO[0167] performing slow lookup of group ids for node INFO[0167] Running: [/bin/sh -c npm build]
Unknown command: "build"

riosje commented 1 year ago

Hi, that error is not related to the Nodejs installation itself. it is related yo your app build process.