Skip to content

Commit c283e68

Browse files
committed
update worker Docker
1 parent 44d2adc commit c283e68

5 files changed

Lines changed: 21 additions & 50 deletions

File tree

docker/worker/Dockerfile

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ RUN apk add --update libc6-compat python3 make g++
44
# needed for pdfjs-dist
55
RUN apk add --no-cache build-base cairo-dev pango-dev
66

7-
# Install Chromium
7+
# Install Chromium and curl for container-level health checks
88
RUN apk add --no-cache chromium curl
99

1010
#install PNPM globaly
@@ -25,6 +25,7 @@ RUN pnpm install
2525
RUN pnpm build
2626

2727
# --- Healthcheck Setup ---
28+
2829
WORKDIR /app/healthcheck
2930

3031
COPY docker/worker/healthcheck/package.json .
@@ -38,7 +39,11 @@ COPY docker/worker/healthcheck/healthcheck.js .
3839
# Set the main working directory back
3940
WORKDIR /usr/src
4041

41-
EXPOSE 3000
42+
# Environment variables for port configuration
43+
ENV PORT=3000
4244

43-
# Start healthcheck in background and flowise in foreground
45+
# Expose port (can be overridden by env var)
46+
EXPOSE ${PORT}
47+
48+
# Start healthcheck in background and flowise worker in foreground
4449
CMD ["/bin/sh", "-c", "node /app/healthcheck/healthcheck.js & sleep 5 && pnpm run start-worker"]

docker/worker/Dockerfile.worker

Lines changed: 0 additions & 40 deletions
This file was deleted.

docker/worker/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ Here’s an overview of the process:
1818

1919
## Setting up Worker:
2020

21-
1. Copy paste the same `.env` file used to setup main server. Change the `PORT` to other available port numbers. Ex: 5566
22-
2. `docker compose up -d`
23-
3. Open [http://localhost:5566](http://localhost:5566)
21+
1. Navigat to `docker/worker` folder
22+
2. Copy paste the same `.env` file used to setup main server. Change the `PORT` to other available port numbers. Ex: 5566
23+
3. `docker compose up -d`
2424
4. You can bring the worker container down by `docker compose stop`

docker/worker/docker-compose.yml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ version: '3.1'
22

33
services:
44
flowise:
5-
image: flowiseai/flowise
5+
image: flowiseai/flowise-bullmq-worker:latest
66
restart: always
77
environment:
88
- PORT=${PORT}
@@ -125,6 +125,12 @@ services:
125125
- ENABLE_BULLMQ_DASHBOARD=${ENABLE_BULLMQ_DASHBOARD}
126126
ports:
127127
- '${PORT}:${PORT}'
128+
healthcheck:
129+
test: ['CMD', 'curl', '-f', 'http://localhost:${PORT}/healthz']
130+
interval: 10s
131+
timeout: 5s
132+
retries: 5
133+
start_period: 30s
128134
volumes:
129135
- ~/.flowise:/root/.flowise
130-
entrypoint: /bin/sh -c "sleep 3; flowise worker"
136+
entrypoint: /bin/sh -c "sleep 3; pnpm run start-worker"

docker/worker/healthcheck/healthcheck.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
// docker/healthcheck/healthcheck.js
21
const express = require('express')
32
const app = express()
4-
const port = 3000
3+
4+
const port = process.env.PORT || 3000
55

66
app.get('/healthz', (req, res) => {
77
res.status(200).send('OK')

0 commit comments

Comments
 (0)