This simple program is used to build our Gatsby website.
-
Install node app.
npm install -g oikeuttaelaimille/builder
-
Start app with systemd.
cat > /etc/systemd/system/builder.service <<EOF [Unit] Description=Builder Service After=network.target [Service] Type=simple User=ubuntu Group=ubuntu WorkingDirectory=/tmp ExecStart=/usr/lib/node_modules/builder/src/index.js Environment=PORT=9999 Environment=COMMAND=/home/ubuntu/scripts/build.sh Environment=COMMAND_WORKING_DIRECTORY=/tmp Environment=NODE_ENV=production [Install] WantedBy=default.target EOF systemctl start builder.service systemctl enable builder.service
-
Add build command
cat > /home/ubuntu/scripts/build.sh <<EOF # Your build script here. npx gatsby build EOF