The YUI Compressor is a CSS & Javascript compression and minification tool based on Java. Official documentation can be found here. There might be many reasons why you would run Java inside a container instead of installing it directly on your machine. This image is based on the popular Alpine Linux project and contains the bare minimum JRE components required to run the YUI Compressor from OpenJDK and weighs in at only ~83MB.
docker run -it -v ${PWD}:/yui --rm nullmem/yuicompressor input.js -o output.min.js
alias yuicompressor="docker run -it -v \${PWD}:/yui --rm nullmem/yuicompressor"
You can also recursively compress all CSS & Javascript files in the current directory and all its subdirectories. This script will ignore all currently minimized files ( *.min.css | *.min.js ) and will overwrite them with the latest minimized version automatically.
docker run -v ${PWD}:/yui -it --rm --entrypoint /bin/batch-compress.sh nullmem/yuicompressor