Writing a build script

If you need to run a custom script which should be run prior to running your server, you can provide a build script following the steps described below.

1. Writing your script

You can write your build script for example using sh.

See an example below which make sure the directory dist and cp the server file to the dist directory:

mkdir -p dist
cp server.js dist

2. Activate the build script in the Dockerfile

In our templates, we usually provide how to activate a build script which you can edit and uncomment. See this example for Node.js.

Deploy

The next time you run openode deploy, your build will be used just before launching the instance.

3. Set the max build duration

If your build takes more time than the average, it might fails due to the max build duration limit. To increase it:

openode set-config MAX_BUILD_DURATION 300 # 300 seconds, as example