Docker
This guide assumes you have knowledge of the following topics:
Why Docker?
Docker provides a consistent environment that ensures the correct operation of any bot in both development and production, as well as simplifying workflow by integrating with CI/CD tools.
With Docker, scaling a bot horizontally is simple, allowing workloads to be distributed across multiple instances as needed.
What files does a Seyfert project need?
There are four files we need:
package.json
: support for JavaScript modulesseyfert.config.js
: configurations for Seyfert/node_modules
: dependencies/src
or/dist
: application entry point
Deploying with Node.js
Dockerfile for a TypeScript project
The example Dockerfile
assumes the following about your project:
- It has the following npm scripts:
start
: runs the application’s entry pointbuild
: transpiles TypeScript code to JavaScript
You must replace <VERSION_TAG>
with the Node.js version you want to use.
With Multi-stage builds
While the previous image is functional, it’s not very optimal or secure. The following example uses multi-stage builds
and dumb-init
: