Debug Netlify build in our local env by using “Netlify Build Image”
We can build & deploy our own application by using Netlify. But, sometimes, we want to debug or test the b […]
広告ここから
広告ここまで
目次
We can build & deploy our own application by using Netlify.
But, sometimes, we want to debug or test the build process in our local environment.
Today, I’ll introduce the “Netlify Build Image” to do this.
Pull the Docker image
The build image of Netlify is published in Dockerhub. So we can pull the images in our local.
$ docker pull netlify/build:xenial
Download the project
We need to download the GitHub repository in our local.
$ git clone [email protected]:netlify/build-image.git
$ cd build-image
Start the Container
We can start and access the container by the command.
$ ./test-tools/start-image.sh path/to/site/repo
buildbot@0605048257f4:/$
And we can run the build command like this.
$ /opt/build-bin/build npm run build
If you want to stop and exit the container, we just run exit
command.
Build with cache
We can build the application with cache by the following command.
./test-tools/test-build.sh path/to/site/repo
Using temp cache dir: tmp/tmp.oJosE3kthn/cache
Cloning into '/opt/buildhome/repo'…