This is docker container for building frontend web assets recursively from multiple subfolders with grunt, gulp or webpack. (More tools will be added when they became popular).
This container is designed for CMS projects like Drupal or WordPress which can have multiple different themes in one project.
You can download the image by running:
$ docker pull pihvio/node-assets-builder- It searches directories with
package.jsonandbower.json - It installs packages from those folders with
yarnandbower - It searches
Gruntfile.js,gulpfile.jsandwebpack.jsfrom those same directories - It builds all of the founded files with default configurations
Here's an example theme folder structure which can be builded with this project:
/build/themes
├── theme1
│ ├── package.json
│ └── webpack.js
├── theme2
│ ├── Gruntfile.js
│ ├── bower.json
│ └── package.json
└── theme3
├── gulpfile.js
└── package.json
In this example we would use following envs: MAX_DEPTH=3 and BUILD_DIR=/build/themes:
$ docker run -v ./themes:/build/themes -e MAX_DEPTH=3 -e BUILD_DIR=/build/themes pihvio/node-assets-builder
This would build all 'default' tasks from the provided themes.
PACKAGE_INSTALLER - This defines the default package.json installer. It can be either npm or yarn (default: yarn).
NODE_VERSION - The container contains nvm for using a custom nodejs version. If you define this the container automatically uses custom nodejs version for everything.
MAX_DEPTH - This is the maximum depth for looking for package.json and bower.json (default: 1). You don't want to use too big value in MAX_DEPTH because it will cause chain reaction which installs the dependencies of dependencies again and again.
version: '3'
services:
assets:
image: pihvi/node-assets-builder
environment:
MAX_DEPTH: 3
NODE_VERSION: v8.1.2
PACKAGE_INSTALLER: npm
BUILD_DIR: /build/themes
volumes:
- ./themes:/build/:rw,cached
command: asset-builderMIT