Files
homeassistant-mcp/Dockerfile
jango-blockchained 752b1daa9c Add Docker support and enhance configuration management
- Introduced Dockerfile for building and running the application in a containerized environment.
- Added .dockerignore to exclude unnecessary files from the Docker context.
- Updated README.md with detailed Docker installation instructions and Node.js version management using nvm.
- Refactored environment variable handling in src/index.ts and src/config/hass.config.ts for improved configuration management.
- Enhanced TypeScript configuration to include JSON module resolution and updated exclusion patterns.
- Updated .gitignore to include additional files for better environment management.
2024-12-16 14:37:25 +01:00

38 lines
730 B
Docker

# Build stage
FROM node:20.10.0-alpine AS builder
WORKDIR /app
# Install TypeScript globally
RUN npm install -g typescript
# Copy source files first
COPY . .
# Install all dependencies (including dev dependencies)
RUN npm install
# Build the project
RUN npm run build
# Production stage
FROM node:20.10.0-alpine
WORKDIR /app
# Set Node options for better compatibility
ENV NODE_OPTIONS="--experimental-modules"
ENV NODE_ENV="production"
# Copy package files and install production dependencies
COPY package*.json ./
RUN npm install --omit=dev --ignore-scripts
# Copy built files from builder stage
COPY --from=builder /app/dist ./dist
# Expose default port
EXPOSE 3000
# Start the server
CMD ["node", "dist/index.js"]