/docker-build-and-deploy

Develop & Build GatsbyJS static sites within Docker.

Primary LanguageMakefileMIT LicenseMIT

docker-build-and-deploy

Develop & Build GatsbyJS static sites within a Docker container. Server static website content with Nginx Alpine Docker container.

  • 🚮 Clutter-free host machine: No need to install Node/Gatsby/Webpack/etc on your host machine! Only Docker required (tested on v17.12.0).
  • 🏗 Easy setup: Automatic GatsbyJS site initializion with gatsby-starter-default (unless already initialized)
  • 👍 Simple CLI API: develop/stage/build
  • 🆕 Recent NodeJS: Container based on NodeJS v10.15.2 running in Ubuntu Linux 19.04
  • 📃 MIT-licensed

Setup

NOTE: Your GatsbyJS site will be created into $GATSBY_ROOT defined in .makerc automatically.

Usage

Init

Before your either start developing or running nginx in production you should init your environment with the following:

make init
# edit .makerc
make gatsby__docker_build

Develop

make gatsby_develop

Stage

In other words, build and serve:

make gatsby_stage

Build

Builds production ready site into $GATSBY_ROOT/public:

make gatsby_build

Run arbitary command inside the container

make gatsby__docker_run cmd=<YOUR-COMMAND-HERE>

For example to install a new NPM-module:

make gatsby__docker_run cmd=yarn add gatsby-transformer-yaml

Run Nginx in production

make gatsby_build
make nginx_stage_build
make nginx_stage_run