Alpine Linux Install Npm

2/13/2022by admin

In a recent post, I described how to debug Google Chrome (Headless) on Amazon ECS. This time we are going to look at how to run Google Chrome (Headless) inside a Docker container.

Dockerize NodeJS applications using Alpine Linux with ease When using alpine, you need to install build dependencies for some node module to be able to be built natively.

  • Alpine Linux seems to be getting quite popular for it’s extremely small size and great package availability. Installing BlinkStick with Node.JS or Python support is quite simple. Install by running these two commands: sudo apk add -update alpine-sdk nodejs linux-headers libusb-dev eudev-dev npm install blinkstick.
  • So I can't get to install npm in alpine linux. I thought perhaps I can just do a apk add npm but apparently apk search npm returns nothing, even after a apk update.I'm experimenting with all this from the nginx:alpine docker image, i.e. Docker run -it nginx:alpine /bin/sh.
  • Package details. Package: nodejs: Version: 14.18.0-r0: Description: JavaScript runtime built on V8 engine - LTS version.
  • Smaller base images with Alpine. You could replace the distroless base image with an Alpine based image. Alpine Linux is: a security-oriented, lightweight Linux distribution based on musl libc and busybox. In other words, a Linux distribution that is smaller in size and more secure. You shouldn't take their words for granted.

While I used Amazon ECS, the same applies to Docker running on any host from local to another hosted provider.

The base image here was for NodeJS, however, any other Alpine based distribution will work just as well.

The first step is to create your Dockerfile. First, we add the edge repositories to the base Node image and then we use apk to install Chromium and all the required dependencies.

Alpine Linux Install Npm

See Full List On

As I was using puppeteer in NodeJS, which typically downloads its own version of Chromium, we use the PUPPETEER_SKIP_CHROMIUM_DOWNLOAD variable to tell puppeteer that we wish for it to skip this process.

Alpine Linux Install Npm Software

Once you have created your Dockerfile the next step is to build the image. We can use the docker command line tool here to build the image for us. Specify a tag for your image after the -t parameter.

The first time you run the build you will see a little more output than this as the required dependencies are downloaded.

The final step now is to run your Docker container. If you wish to test this locally you can simply issue the docker run command. If you wish to forward any ports you can use the -p command for this. › Complete-intro-to-containersMaking Our Own Alpine Node.js Container – Making Tiny ...

That’s it! Now your Docker container is running and you can connect to your application via http://localhost:3000/

Comments are closed.