All jobs

Dockerize a Slack Bolt App

Yes. An agent writes a Dockerfile, .dockerignore and Compose file for your Socket Mode Bolt app: tokens from an env file, no published port, and a build that ran.

Run this on RushOpens the console with this prompt ready to send, in a Project that has your repository.

What the agent does

The agent reads how the app connects to Slack before it writes a line of Docker, because Socket Mode changes what a container needs. In an app shaped like slack-samples/bolt-js-getting-started-app, package.json is an ES module with one dependency, @slack/bolt 5, one script, start: node app.js, a package-lock.json, and no engines field. app.js builds new App({ token, socketMode: true, appToken }) from SLACK_BOT_TOKEN and SLACK_APP_TOKEN, listens for messages containing hello, answers with a Block Kit section and a button_click button, acknowledges the action, and calls app.start(process.env.PORT || 3000). manifest.json confirms it: socket_mode_enabled is true, interactivity is on, and the bot has channels:history, chat:write and im:history with message.channels and message.im events. So the app opens an outbound WebSocket to Slack and receives nothing on an inbound port; the PORT in app.start is never reached by Slack traffic.

That decides the shape of the image. The Dockerfile is a single stage on a current Node LTS Alpine image, which the agent chooses by reading the engines field of the installed @slack/bolt package in node_modules since the app itself pins none, and names in the pull request. It copies package.json and package-lock.json, runs npm ci --omit=dev, copies app.js and manifest.json, switches to the node user and ends with CMD ["node", "app.js"] rather than npm start, so SIGTERM from docker stop reaches the Node process instead of an npm wrapper. There is no EXPOSE and no HEALTHCHECK that curls a port, because there is no port to check; the description explains that the process staying up and the Bolt app is running log line are the health signal, and where an auth.test call would go if a check is required.

Tokens never go in the image. The agent adds .env.example with the two variable names and no values, env_file: .env in a docker-compose.yml with one service, restart: unless-stopped and no ports, and puts .env in both .gitignore, which today lists only node_modules/, and the new .dockerignore together with node_modules, .git and the .github folder. README.md gets a short section on building and running the container beside the existing npm start instructions.

Rush's sandbox has no Docker, so the agent installs it with sudo apt-get install -y docker.io, starts dockerd, builds the image and runs it with placeholder tokens. That cannot reach a workspace, but it proves what the pull request claims: the image builds, the entry point runs as node, the env file is read, and Bolt fails with Slack's authentication error for the placeholder app token rather than a module or file error. It pastes the build log, the container's log lines and the exit code into the pull request and says that a run with real tokens is the reader's step. It checks the Compose file with the v1 docker-compose that the docker.io package ships, which the description notes.

Start it with one API call

POST https://api.phoenix.so/o/{org}/sessions with this body:

{
  "agent": "claude",
  "input": "Dockerize this Slack Bolt app. Read package.json, package-lock.json, app.js, manifest.json, .gitignore, AGENTS.md and README.md first. The app uses Socket Mode, so it needs no inbound port: write a single-stage Dockerfile on a current Node LTS Alpine image that fits the engines field of the installed @slack/bolt package, run npm ci --omit=dev, copy app.js and manifest.json, run as the node user with CMD node app.js so SIGTERM reaches the process, and add no EXPOSE or port healthcheck; explain the health signal in the pull request. Add .dockerignore, .env.example with SLACK_BOT_TOKEN and SLACK_APP_TOKEN, add .env to .gitignore and .dockerignore, and a docker-compose.yml with one service using env_file .env, restart unless-stopped and no ports. Add a container section to README.md. Install Docker in your sandbox (apt-get install docker.io, start dockerd), build the image, run it with placeholder tokens and paste the build log, the container's log lines and exit code into the pull request, saying plainly that a run with real tokens is the reader's step. Follow AGENTS.md: no code comments. Change nothing in app.js.",
  "resources": [
    {
      "url": "https://github.com/your-org/your-app"
    }
  ]
}
  1. Get an API key. In the console, open Settings, then API keys, and create a key for your org. Send it in the Authorization header as a Bearer token.
  2. Send the request. POST the body in request.json to https://api.phoenix.so/o/{org}/sessions, with your repository as the resources URL. The run starts in its own cloud sandbox.
  3. Read what came back. Follow the run on its live stream or wait for the run.completed webhook, then read the result and its trajectory.

What comes back

The pull request adds Dockerfile, .dockerignore, .env.example and docker-compose.yml, adds .env to .gitignore, and adds a section to README.md; app.js and manifest.json are untouched. Its description shows the image build log, the docker run with the env file, the container's log up to Slack's authentication error on the placeholder app token, the exit code, and the Node and Bolt versions it chose and why.

What the image does not prove is a working connection to a workspace, and the description says so: the next step is the reader's .env with a bot token and an app-level token with connections:write, after which the Bolt app is running line and a hello message in a channel are the check.

Before merging, a reviewer confirms the Node major matches what they run elsewhere, decides whether the service needs a restart policy at all on their platform, and, if they require a health check, picks the auth.test approach the description outlines rather than a port probe.

Run it on every Slack app without a Dockerfile

An engineer who was asked to move the bot off a laptop starts this from the terminal with this body and goes back to the feature they were on. The run reads the real app.js and manifest.json, so it writes the container for a Socket Mode app rather than assuming an HTTP receiver that needs a public URL and a signing secret.

Send a request_id, a UUID, with the body so a retried start returns the run it already began. The pull request link is on the run's GET /o/{org}/sessions/{id} answer once it is open, and a key with a webhook_url hears run.completed when the turn ends. A team with several Bolt apps sends one body per repository; an app on the HTTP receiver in the same batch gets a port, a health route and SLACK_SIGNING_SECRET instead.

The use case this job follows, with its automation and trigger: Hand off a long task.

Why run it on Rush?

The mistakes in a Bolt Dockerfile are quiet ones: a published port nobody uses, tokens baked into a layer, npm start swallowing the stop signal, a Node image older than the SDK supports. The agent reads the manifest and the SDK's own engines field, builds and runs the image in its own sandbox with Docker installed for that run, and shows the container's first log lines, so the pull request stands on a build that happened rather than a Dockerfile that looks right.

Every command and its output stays on the run, including the build log and the container's exit, so a reviewer can see what the image does without building it. Several bots can be containerised at once, each in its own sandbox, and nothing merges until a person reads the diff.

Frequently asked questions

Why no EXPOSE or published port?

Because app.js sets socketMode: true and manifest.json has socket_mode_enabled, so the app opens an outbound WebSocket to Slack and receives events over it. The PORT in app.start is not used for Slack traffic, and publishing it would only invite a probe that answers nothing useful. An app on the HTTP receiver is the case where a port, a public URL and SLACK_SIGNING_SECRET matter.

Why CMD node app.js instead of npm start?

With npm start, npm is the container's main process and does not reliably forward SIGTERM to the Node child, so docker stop waits for its timeout and then kills the app mid-event. Running node app.js directly makes Node the process that receives the signal. The start script stays in package.json for local use.

How does it prove the image works without my tokens?

It runs the container with placeholder values for SLACK_BOT_TOKEN and SLACK_APP_TOKEN. Bolt starts, reads them from the env file and fails on Slack's authentication error for the app-level token, which shows the image, the entry point, the user and the env wiring are right. The pull request says this plainly and leaves the run with real tokens to the reader.

Where do the tokens live?

In a .env file the Compose service reads with env_file, listed in .gitignore and .dockerignore so it is neither committed nor copied into a layer. .env.example names the two variables with no values. On a platform with its own secret store, the same two variables are set there and the Compose file is not needed.

Does it add a health check?

Not a port probe, since there is no port. The description explains the signal that exists today, the Bolt app is running log line and the process staying up, and sketches a HEALTHCHECK that calls auth.test through the Web API client if the platform insists on one. That adds a dependency on Slack's API being reachable from the check, which is why it is left as a choice.

More Slack Bolt jobs

The same job on other stacks

Keep reading