This project is inspired by https://hub.docker.com/r/zenoss/gulp/
Dockerfile for nodejs, npm, and gulp, with a focus on making it as easy as possible to run gulp tasks.
- Docker Desktop
We are going to build the image once. Then we are going to create a commands that will start a container and run npn/gulp/yarn tasks.
Clone the project whatever you want, it's better to be where all other project folders are.
On the same directory where Dockerfile is run
docker build -t ui-build .
In ~/.bashrc file add next lines to alias npm and gupl commands
alias npm='docker run --rm -v $(pwd)/:/app/ -u $(id -u):$(id -g) ui-build npm'
alias gulp='docker run --rm -v $(pwd)/:/app/ -u $(id -u):$(id -g) ui-build gulp'
alias yarn='docker run --rm -v $(pwd)/:/app/ -u $(id -u):$(id -g) ui-build yarn'
source ~/.bashrc
Go to the project folder
If this is your first time running gulp for this project, the dependencies will need to be installed first. This is typically done by running npm install in the directory where package.json is located. If nodejs and npm are not installed locally, the docker container can be used to perform the install task.
This image expects a directory with project to be bind mounted at /app, and a gulpfile to be placed in _build folder of the project.
npm install
gulp build
this is the default command
gulp sass
build all .scss files and create corresponding .css files
gulp sass-community
gulp sass-public
gulp sass-magazin
gulp sass-click-tt
gulp sass-shared
if we need to rebuild specific module of the project
gulp watch
start watch process and if we change a file in _sass folder this will trigger a sass command