A versatile Docker image for running Node.js applications with built-in process management, providing a ready-to-use environment to deploy and manage your JavaScript projects.
Quick Start • Development • Documentation • Contributing
UDX Worker Node.js is a specialized Docker image built on UDX Worker that provides:
- 🔧 Node.js Runtime: Ready-to-use environment for JavaScript applications
- 📦 Process Management: Built-in supervisor-based service management
- 🛠️ Service Configuration: YAML-based service definition and control
- 🔄 Zero Downtime: Seamless application updates and restarts
- 🏗️ Base Image: Built on
udx-worker
for secure, efficient operations
Docker
installed and running on your system- Node.js application code (optional)
- Create a service configuration in
.config/worker/services.yaml
:
kind: workerService
version: udx.io/worker-v1/service
services:
- name: "node-app"
command: "node index.js"
autostart: true
autorestart: true
envs:
- "PORT=3000"
- Pull and run the image:
docker pull usabilitydynamics/udx-worker-nodejs:latest
docker run -d --name my-node-app -p 3000:3000 -v $(pwd)/.config:/home/udx/.config usabilitydynamics/udx-worker-nodejs:latest
- Create your service configuration in
.config/worker/services.yaml
:
kind: workerService
version: udx.io/worker-v1/service
services:
- name: "api-server"
command: "node api/server.js"
autostart: true
autorestart: true
envs:
- "PORT=3000"
- "NODE_ENV=production"
- name: "worker-queue"
command: "node worker.js"
autostart: true
envs:
- "QUEUE_URL=redis://localhost:6379"
- Create a
docker-compose.yml
:
version: '3'
services:
app:
image: usabilitydynamics/udx-worker-nodejs:latest
volumes:
- ./:/usr/src/app
- ./.config:/home/udx/.config
ports:
- "3000:3000"
- Clone this repository:
git clone https://github.com/udx/udx-worker-nodejs.git
cd udx-worker-nodejs
- Build the Docker image:
make build
- Run Tests to verify functionality:
make run-all-tests
You can add additional tests in the src/tests/
directory as needed.
You can configure build and runtime variables in Makefile.variables
:
- Node.js version. (Node.js 20.x LTS supported by default)
- Port mappings
- Source paths
Adjust these variables to suit your environment or specific deployment requirements.
Use make to view all available commands:
make help
These commands offer options for building, running, and testing your application seamlessly.
Built on udx-worker
, this image benefits from secure, resource-efficient configurations and best practices, providing a reliable foundation for Node.js applications.
- Process Management: Uses supervisor-based worker process manager
- Service Configuration: Defined through
services.yaml
- Configuration: Customizable through
Makefile.variables
- Build variables can be configured in
Makefile.variables
- View available commands with
make help
- Test examples available in
src/tests/
Contribute to the project:
- Fork the repository
- Create your feature branch
- Submit a pull request
We welcome contributions! Here's how you can help:
- Fork the repository
- Create a feature branch
- Commit your changes
- Push to your branch
- Open a Pull Request
Please ensure your PR:
- Follows our coding standards
- Includes appropriate tests
- Updates relevant documentation
Need specific features or customizations? Contact our team for professional development services.
This project is licensed under the MIT License - see the LICENSE file for details.