Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Use official Node.js LTS image
FROM node:20

# Set working directory
WORKDIR /usr/src/app

# Copy package.json and package-lock.json
COPY package*.json ./

# Install dependencies
RUN npm install

# Copy the rest of the app
COPY . .

# Expose app port
EXPOSE 3000

# Start the app
CMD ["npm", "start"]
32 changes: 32 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -193,3 +193,35 @@ Here are some suggestions for the next set of tasks for candidates to further en
- **Continuous Integration (CI)**:
- Set up a CI pipeline using GitHub Actions to automatically run tests and lint checks on every push and pull request.
```
## Running the Project with Docker

### Prerequisites
Before running the application in Docker, ensure the following are installed:

| Requirement | Required? | Instructions |
|------------|----------|--------------|
| **Docker Desktop (Windows/macOS)** https://www.docker.com/products/docker-desktop/ |
| **Docker Compose** Comes bundled with Docker Desktop / Docker Engine |

> **Windows/macOS users must start Docker Desktop before running any docker-compose commands.**

---

### Start Docker (Windows/macOS users)
1. Open **Docker Desktop** from the Start Menu.
2. Wait until it shows: **"Docker is running"**.
3. build and run containers
docker-compose up --build

### This project uses Nodemailer to send email notifications (e.g., for task creation and updation, user registration confirmation)

# Nodemailer Email Configuration (add in .env)
EMAIL_PASS=your-email-password
EMAIL_USER=<your-email@example.com>

## This project uses Redis for job queues (via BullMQ). When running with Docker, Redis is included as a service.
# The default host and port in Docker Compose are:
REDIS_HOST=redis
REDIS_PORT=6379


55 changes: 55 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
version: "3.9"

services:
app:
build: .
container_name: node-app
ports:
- "${PORT}:${PORT}"
env_file:
- .env
depends_on:
- postgres
- redis

worker:
build: .
container_name: email-worker
env_file:
- .env
depends_on:
- redis
- postgres
command: node src/workers/emailWorker.js

postgres:
image: postgres:15
container_name: postgres
restart: always
environment:
POSTGRES_USER: ${DB_USER}
POSTGRES_PASSWORD: ${DB_PASSWORD}
POSTGRES_DB: ${DB_NAME}
ports:
- "${DB_PORT}:${DB_PORT}"
volumes:
- pgdata:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U ${DB_USER}"]
interval: 5s
timeout: 5s
retries: 5

redis:
image: redis:7
container_name: redis
ports:
- "${REDIS_PORT}:${REDIS_PORT}"
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 5s
timeout: 5s
retries: 5

volumes:
pgdata:
Loading