Build static assets with Docker
tl;dr
Consider making the “Hello, world!” instruction to build your project/docs/tests a single, simple docker run
. That way, your users don’t have to mess around trying to get an environment working. Host the base image on Docker hub and you’re done!
Building static assets
Docker is a neat tool. Today I made use of it to build all my web app’s static assets (SASS to CSS, JS concatenation, minification, etc…). I got tired of manually installing Ruby, NodeJS, and Python packages on the various machines I use (OS X and Ubuntu). So I punted to Docker.
Here’s my Dockerfile:
I create a build-capable container on any machine with Docker installed:
Then I mount the project directory and build/install all the assets:
(build.sh
is a custom build script for this particular project. You could also use Grunt/gulp/whatever).
Collaboration win
I did this for a personal project on which the only collaborators are myself and myself on a different computer. But such a setup would be great on projects with lots of collaborators.
Thanks, Docker!