Add a specific node version in ruby-alpine docker image

Viewed 2864

I'm using ruby:2.6.5-alpine as my base image and I'm trying to add a specific node version to it.

FROM ruby:2.6.5-alpine

RUN apk update \
 && apk upgrade --no-cache \
 && apk add  nodejs=12.18.0

# remaining configs

But when I specify a version, I'm getting this error

ERROR: unsatisfiable constraints:
  nodejs-12.15.0-r1:
    breaks: world[nodejs=12.18.0]
    satisfies: yarn-1.19.2-r0[nodejs]

if I simply do RUN apk add nodejs it works fine

1 Answers

You can install nodejs from main repository while v3.12 contain node 12.7.x.

alpine nodejs-12.18.x

FROM ruby:2.6.5-alpine

RUN apk update \
 && apk upgrade --no-cache
RUN apk add  --no-cache --repository http://dl-cdn.alpinelinux.org/alpine/edge/main/ nodejs=12.18.2-r0 npm  

Related