diff --git a/worker/Dockerfile b/worker/Dockerfile new file mode 100644 index 0000000..0d09f63 --- /dev/null +++ b/worker/Dockerfile @@ -0,0 +1,24 @@ +FROM node:20 + +# Create app directory +WORKDIR /usr/src/app + +# Install dependencies first (copy package files) +COPY package.json package-lock.json ./ + +# Install full dependencies so `tsx` can run worker/index.ts +RUN npm ci --silent + +# Copy only required directories to keep image smaller +COPY worker ./worker +COPY lib ./lib +COPY node_modules ./node_modules +COPY .env* ./ +COPY tsconfig.json ./ + +ENV NODE_ENV=production + +# Set working directory to repo root; worker is invoked by npm script +WORKDIR /usr/src/app + +CMD ["npm", "run", "worker:start"] diff --git a/worker/README.md b/worker/README.md new file mode 100644 index 0000000..88e763e --- /dev/null +++ b/worker/README.md @@ -0,0 +1,21 @@ +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.