ibaralf
ibaralf

Reputation: 12528

How to use linux Alpine and install ruby 2.1 and nodejs v6.9

I'm trying to create a lightweight docker image but using linux alpine to install specific versions seems to result in many different errors. Currently my working Dockerfile uses

   FROM ruby:2.1.10  
   RUN apt-get install nodejs=6.11.1 

but this results in 1.69GB size.

I would like to use linux Alpine and install ruby 2.1 and nodejs 6.9 or 6.11 - how do I go about this

1) I tried starting from ruby:2.1.10-alpine but cannot get apk add nodejs to install with 6.9

2) Also tried starting from node:6.11.1-alpine and installing ruby 2.1

Maybe start from an empty alpine image and install both? Sorry I'm not familiar with Alpine and installing packages on it seems to be specific to the alpine version (maybe I'm wrong with this).

Upvotes: 1

Views: 6964

Answers (1)

Ayushya
Ayushya

Reputation: 10447

With the help of alpine node and ruby alpine, here is a dockerfile which has ruby and nodejs installed in alpine and it is 130MB in size.

If you are building a alpine dockerfile, then these guidelines might be helpful to you:

  • apt-get install changes to apk add in alpine.

  • After adding an apk, you might want to use && rm -rf /var/lib/apk/* after all apk are added. This removes extra files which got cached.

  • Use fewer RUN statements. Every RUN statement will add up a new layer.

Upvotes: 4

Related Questions