TL;DR Just developed a “single-click” Docker file to deploy a private NPM repository using Sinopia and Nginx. Not on the Docker hub yet, but you can pull it from my Github at https://github.com/chris-tomich/sinopia-nginx.
I’ve been using Docker quite a lot the past 2 weeks to simplify Oystr’s deployment and I’ve really come to love it! Whilst I do love the ease at which you can create repeatable and easily transferable deployment environments, I think what has really bought me over is the way in which you are working in a completely isolated environment without having to go to the extent of a virtual machine.
Thanks to my personal enlightenment on the wonders of Docker (and the current “oooh I have a new toy” fanboy obsession I’ve grown), I decided to write a Dockerfile for a Sinopia and Nginx deployment. If you’re not familiar with Sinopia, it’s basically a private NPM repository. It’s not a full repository like the official NPM one (for a start it uses the file system as storage, not Couch DB), but it does a pretty good job at emulating one. You can find out more about it at https://www.npmjs.com/package/sinopia.
I did try to use the two most popular Docker images for Sinopia currently on the Docker hub, but I couldn’t get them working with a single click – and I really wanted a single-click script. So like any good (and impatient) developer, I rolled my own. Hopefully it’ll mean you won’t have to! (although I totally understand if you do 😉 )
You can get the Dockerfile and related files from my Github at https://github.com/chris-tomich/sinopia-nginx and build it for yourself very easily with the following commands –
- sudo docker build -t sinopia-nginx .
- sudo docker run -p 80:80 –name sinopia -d sinopia-nginx
I’ll write some better documentation over the next week and upgrade it a little, but for now if you’re just wanting a single click Sinopia deployment, this should hopefully suffice. My plan is to upgrade it so that –
- The Sinopia config.yaml and the Nginx nginx.conf files are mapped to volumes.
- The Sinopia storage is mapped to a volume.
- A way to provide Nginx with certificates/keys for SSL and automatic setup of SSL.