Docker Images, Basic Files and Directories for build sites
To use this builder directly, you need to install node
(>= 6.9) and yarn
(> 0.16).
As node-gyp
is using, you have to install make, g++ and python.
curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -
curl -sS https://deb.nodesource.com/gpgkey/nodesource.gpg.key | sudo apt-key add -
echo "deb https://deb.nodesource.com/node_6.x $(lsb_release -s -c) main" | sudo tee /etc/apt/sources.list.d/nodesource.list
echo "deb-src https://deb.nodesource.com/node_6.x $(lsb_release -s -c) main" | sudo tee -a /etc/apt/sources.list.d/nodesource.list
echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
It is recommended to use [nvm][https://github.com/creationix/nvm] for the installation. After nvm was setup:
nvm install stable
nvm use stable
npm install -g yarn
God bless you
You may run your site with the development mode:
yarn dev
The resulting files will be in the folder "./public" and a development server will be started listing at "http://localhost:8080".
You may build the production site directly with NodeJS in your OS. The resulting files will be in the folder "./public".
The command to build the whole site:
yarn build
You may partially build assets with gulp commands. You may find all gulp options with the help command:
./node_modules/.bin/gulp help
You may use this repository to build your site with a Docker image.
If you prefer to build your own docker image, you will first need to make sure
you local docker have proper network setup. On Ubuntu, you should edit the file
/etc/default/docker
. Find this line and uncomment it.
DOCKER_OPTS="--dns 8.8.8.8 --dns 8.8.4.4"
Run this after the change:
sudo systemctl restart docker
Then build the image with this command:
docker build -t="404busters/builder" .
With the docker image in your local docker system, you have to define a local
folder to receive the result. Assume you want to have the files built into
$PWD/public
:
docker run --name builder -it --rm \
-v $PWD/public:/app/public 404busters/builder
Please replace the folder $PWD/public
to a path that suit your needs.
You may also use the image in interactive development mode. You'll need to
specify the assets
folder to build from. For example, if your developing
assets are located at $PWD/myAssets
:
docker run --name builder -it --rm \
-v $PWD/public:/app/public -v $PWD/assets:/app/assets \
404busters/builder dev
Docker will pass all the commands to the gulp. You may see all the command options with this:
docker run --name builder -it --rm 404busters/builder help