tenantpilot/worker/README.md
Ahmed Darrazi cd2abed1ab
All checks were successful
Trigger Cloudarix Deploy / call-webhook (push) Successful in 1s
fix(worker): update Dockerfile and README - build path must be / (repo root)
2025-12-09 12:53:02 +01:00

55 lines
2.5 KiB
Markdown

Worker container and Dokploy settings
====================================
Build context
-------------
- **Build path: `/` (repo root)** — NOT `worker/`!
- **Dockerfile path: `worker/Dockerfile`**
**IMPORTANT**: Dokploy must build from the repo root (`/`) so the Dockerfile can access `package.json`, `lib/`, and other files. If build path is set to `worker/`, the build will fail with "package.json: not found".
Two-stage build (recommended)
-----------------------------
- This repository includes a two-stage Dockerfile that compiles TypeScript in a builder stage and produces a smaller runtime image.
- The builder stage runs `npx tsc -p tsconfig.json --outDir dist` and the runtime stage will run the compiled `dist/worker/index.js` if present. If compilation is not performed, the container falls back to running `npx tsx ./worker/index.ts`.
Recommended Dokploy settings
----------------------------
- Provider: `Gitea`
- Repository: `ahmido/tenantpilot` (or your repo)
- Branch: `development`
- **Build path: `/`** (repo root)
- **Dockerfile path: `worker/Dockerfile`**
- Watch paths: `worker/**`, `lib/**`, `package.json`, `package-lock.json`
Notes
-----
- The Dockerfile attempts to run compiled JS first; if no compiled output is present the runtime falls back to `tsx`.
- If Dokploy requires a separate webhook per app, use the worker webhook URL provided in this repo's docs/workflow.
Notes on environment
--------------------
- Ensure Dokploy provides `REDIS_URL` in the environment for the worker container.
- Provide Azure AD secrets in Dokploy environment vars: `AZURE_AD_TENANT_ID`, `AZURE_AD_CLIENT_ID`, `AZURE_AD_CLIENT_SECRET`.
Worker container and Dokploy settings
====================================
Build context
-------------
- Build path: `worker/` (Dokploy should use this path so the worker Dockerfile is found)
- Dockerfile: `worker/Dockerfile`
Recommended Dokploy settings
----------------------------
- Provider: `Gitea`
- Repository: `ahmido/tenantpilot` (or your repo)
- Branch: `development`
- Build path: `worker/`
- Watch paths: `worker/**`, `lib/**`, `package.json`, `package-lock.json`
Notes
-----
- The `Dockerfile` runs `npm ci` and then `npm run worker:start`, which uses `tsx` to execute `worker/index.ts` directly.
- If you prefer a smaller production image, consider adding a build step to compile TypeScript to JS and run the compiled output with `node`.
- If Dokploy requires a separate webhook per app, use the worker webhook URL provided in this repo's docs/workflow.