Node-Alpine images with Git

This will be short and sweet.

I was building out an image for a swagger diff api (link)
and quickly realised that the size of the Node-Jessie image is > 600mb. Which is just too bloody much for my 12 lines of expressjs.


This image is based on the popular Alpine Linux project, available in the alpine official image. Alpine Linux is much smaller than most distribution base images (~5MB), and thus leads to much slimmer images in general.
This variant is highly recommended when final image size being as small as possible is desired. The main caveat to note is that it does use musl libc instead of glibc and friends, so certain software might run into issues depending on the depth of their libc requirements. However, most software doesn’t have an issue with this, so this variant is usually a very safe choice. See this Hacker News comment thread for more discussion of the issues that might arise and some pro/con comparisons of using Alpine-based images.


To minimize image size, it’s uncommon for additional related tools (such as git or bash) to be included in Alpine-based images. Using this image as a base, add the things you need in your own Dockerfile (see the alpine image description for examples of how to install packages if you are unfamiliar).

https://hub.docker.com/_/node/

The problem with the alpine image is that it does not contain GIT (as you can see from the above quote), which is a requirement for NPM to work properly.

So, the fast and easy way is to just add git to the dockerfile.

You simply add RUN apk --no-cache add git to your Dockerfile and you are good to go.

Doing this I ended up at an image size of 109mb down from 650mb, not bad.
Anyway, my Dockerfile went from

To


Note the change from
node:8.15-jessie to node:8.15-alpine as well.

If you want to know more about packaging simple node services inside a docker container, I highly recommend this article

Developer and Power User Tools

Developer tools

  • Visual Studio Code
    Great editor, that (at least for me) has beaten sublime and the others. – built with electron as well!
  • Visual Studio
    I am a .NET Dev, so this is pretty essential for my daily use.
  • Notepad++
    I’ve switched mostly to use VSCode as my main editor, but for small things I like the speed of notepad++.
  • DockStation
    “Visual Docker” Dock station helps me quickly assemble large container applications with not much more than some drag and drop. Awesome!
  • HashCheck
    A simple right-click menu tool for getting the hash of any file.
  • Advanced Installer – Paid
    For any project I do where I need an installer, I use advanced installer… it’s simply an amazingly easy to use tool for all installation needs. (even does installer from *.sln file.)
  • GitKraken
    The best git gui out there.

Visual Studio Extensions

Ive made this a category by itself as there are many really good extensions.

Power User Tools

  • Fiddler
    Webrequest sniffer.
  • Wireshark
    Package sniffer.
  • Postman
    Best Rest Client.
  • ConEmu
    Guake style powershell prompt – whats not to like?
  • Everything search
    Great indexing and searching engine with a hotkey.
  • 1Password – Paid
    Everyone should be using a password manager these days, I use 1Password.
  • LightShot
    Awesome screenshot taking app.
  • Snagit – Paid
    Another amazing screenshot tool.
  • Evernote
    Notetaking for pro’s. nothing to more to say.
  • OneNote
    Another great notetaking app.

Chrome Addons

  • YSlow
    A website “slowness” tester for chrome.
  • Toby
    A much better (shareable) start page for chrome.
  • Awesome Screenshot
    Full page screenshots.
  • ColorZilla
    A Colorpicker.

Websites

  • Codepen.io
    Some fiddle, some bin, some plunk.. I pen.
  • Foundation for email
    Need html emails, but have html and separate css? – no problem.
  • APIMatic
    Transform any api spec into any other api spec.
  • Can I Use
    Lookup any html/css feature and see if its supported by browser xyz.
  • GuidGenerator
    A great looking, simple to use, Guid (v4) Generator.
  • Cron expression editor
    I keep forgetting how to Cron.. never again!
  • Http Status Codes api
    Awesome api to test statuscode handling – just request http://httpstat.us/418 or any other (Supported) status code.
  • Simple Online Rest Api
    When you just need to prototype – Request one of the endpoints and itll return what you sent (basically).