Dockerfile•1.02 kB
# OPNSense MCP Server - SSE Deployment
FROM node:20-alpine
# Install build dependencies
RUN apk add --no-cache python3 make g++
# Create app directory
WORKDIR /app
# Copy package files
COPY package*.json ./
# Install dependencies
RUN npm ci --only=production
# Copy TypeScript config and source
COPY tsconfig.json ./
COPY src ./src
# Build the application
RUN npm run build
# Remove dev dependencies and build tools
RUN npm prune --production && \
apk del python3 make g++
# Create non-root user
RUN addgroup -g 1001 -S nodejs && \
adduser -S nodejs -u 1001
# Change ownership
RUN chown -R nodejs:nodejs /app
# Switch to non-root user
USER nodejs
# Expose SSE port
EXPOSE 3000
# Health check endpoint
HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \
CMD node -e "require('http').get('http://localhost:3000/health', (res) => { process.exit(res.statusCode === 200 ? 0 : 1); })"
# Default to SSE transport
CMD ["node", "dist/index.js", "--transport", "sse", "--port", "3000"]