Add Docker support and enhance server configuration
- Created Dockerfile for containerized deployment - Added .dockerignore to optimize Docker build context - Updated README with comprehensive Docker setup instructions - Implemented new server endpoints: * Health check endpoint * Device listing * Device control * SSE event subscription - Enhanced security middleware with request validation and input sanitization - Added error handling and token-based authentication for new endpoints
This commit is contained in:
23
Dockerfile
Normal file
23
Dockerfile
Normal file
@@ -0,0 +1,23 @@
|
||||
# Use Node.js 20 as the base image
|
||||
FROM node:20-slim
|
||||
|
||||
# Install curl for healthcheck
|
||||
RUN apt-get update && apt-get install -y curl && rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# Set working directory
|
||||
WORKDIR /app
|
||||
|
||||
# Copy source code first
|
||||
COPY . .
|
||||
|
||||
# Install dependencies
|
||||
RUN npm install
|
||||
|
||||
# Build TypeScript
|
||||
RUN npm run build
|
||||
|
||||
# Expose the port the app runs on
|
||||
EXPOSE 3000
|
||||
|
||||
# Start the application
|
||||
CMD ["node", "dist/src/index.js"]
|
||||
Reference in New Issue
Block a user