Install Git In Alpine

  1. Apk Add
  2. Install Git In Alpine Linux
  3. Install Git In Alpine Windows
Apk

Alpine Linux, unlike mainstream/traditional Linux distributions, is based on BusyBox, a very compact (~5MB) Linux distribution. BusyBox (and thus Alpine Linux) uses a different C/C++ stack to most mainstream/traditional Linux distributions - musl. There currently is no musl based binary published in the nodejs official builds but they do publish a musl based binary in the nodejs unofficial builds which they use in the node:alpine docker image. The node:alpine docker image is a potential alternative to nvm for using node on alpine linux.

For now you can override the nvm_get_arch function to return x64-musl on x64 Alpine Distributions. Currently the Node project only has unofficial builds for x64-musl. Sorry no ARM-musl/x86-musl,etc builds for now. The Node project has some desire but no concrete plans (due to the overheads of building, testing and support) to offer Official Alpine-compatible binaries.

Package details. Package: git: Version: 2.33.0-r2: Description: Distributed version control system. Package details. Package: git: Version: 2.33.0-r2: Description: Distributed version control system. Alpine Edge apk add git build-base linux-headers cmake xfce4-dev-tools Centos 8 yum groupinstall 'Development Tools' yum -y install pkgconfig Debian 10 sudo apt-get -y install git wget pkg-config build-essential cmake autoconf libtool zlib1g-dev lsb-release. $ docker images REPOSITORY TAG IMAGE ID CREATED SIZE ajeetraina/alpine-git latest cb913e37a593 16 seconds ago 26.6MB ajeetraina/labs-git v1.0 cb913e37a593 16 seconds ago 26.6MB.

For more info about unofficial builds visit: https://unofficial-builds.nodejs.org/

If installing nvm on Alpine Linux is still what you want or need to do, you should be able to achieve this by running one of the following from your Alpine Linux shell:

Install git in alpine windows

Using Precompiled Binaries on Alpine

Pre-compiled binaries for musl based architectures are unofficially available for most node versions after node v8.16.0

Apk Add

  • libstdc++ - is the only package that is necessary to run node/npm once it is installed.
  • bash - is required to install nvm... BusyBox's sh has some issues with chmoding the nvm-exec file, but bash can be removed again after install if you want to slim your image.
  • coreutils/curl - is required to for nvm because BusyBox is not 100% POSIX compliant. Mainly ls not accepting a -q argument and wget not having the progress bar option.

Install Git In Alpine Linux

Install git in alpineAlpine

Install Git In Alpine Windows

Since there are no io.js builds available for musl you can also disable all io.js versions from showing up in nvm ls-remote by also running:

Building from Source on Alpine

There is a -s flag for nvm install which requests nvm download Node source and compile it locally. This does not use anything unofficial but it is much slower and more cpu intensive to install and build each version of node.

Similar to the pre-compiled binaries

  • libstdc++ - is the only package that is necessary to run node/npm once it is installed.