81
Dockerfile
Archivo normal
81
Dockerfile
Archivo normal
@@ -0,0 +1,81 @@
|
||||
# CUDA Quantum MCP Server - Production Docker Image
|
||||
# Multi-stage build for optimized production deployment
|
||||
|
||||
# Stage 1: Build environment
|
||||
FROM node:18-slim AS builder
|
||||
|
||||
# Install build dependencies
|
||||
RUN apt-get update && apt-get install -y \
|
||||
python3 \
|
||||
python3-pip \
|
||||
build-essential \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
# Copy package files
|
||||
COPY package*.json ./
|
||||
COPY tsconfig.json ./
|
||||
|
||||
# Install Node.js dependencies
|
||||
RUN npm ci --only=production && npm cache clean --force
|
||||
|
||||
# Copy source code
|
||||
COPY src/ ./src/
|
||||
COPY python/ ./python/
|
||||
|
||||
# Build TypeScript
|
||||
RUN npm run build
|
||||
|
||||
# Stage 2: Production runtime
|
||||
FROM nvidia/cuda:11.8-runtime-ubuntu22.04
|
||||
|
||||
# Install runtime dependencies
|
||||
RUN apt-get update && apt-get install -y \
|
||||
nodejs \
|
||||
npm \
|
||||
python3 \
|
||||
python3-pip \
|
||||
curl \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# Create app user
|
||||
RUN groupadd -r quantum && useradd -r -g quantum quantum
|
||||
|
||||
# Set working directory
|
||||
WORKDIR /app
|
||||
|
||||
# Install CUDA Quantum
|
||||
RUN pip3 install --no-cache-dir cudaq numpy scipy
|
||||
|
||||
# Copy built application
|
||||
COPY --from=builder /app/dist ./dist/
|
||||
COPY --from=builder /app/node_modules ./node_modules/
|
||||
COPY --from=builder /app/python ./python/
|
||||
COPY package*.json ./
|
||||
|
||||
# Copy configuration
|
||||
COPY .env.example ./.env
|
||||
COPY README.md ./
|
||||
|
||||
# Create logs directory
|
||||
RUN mkdir -p logs && chown -R quantum:quantum /app
|
||||
|
||||
# Switch to non-root user
|
||||
USER quantum
|
||||
|
||||
# Health check
|
||||
HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \
|
||||
CMD node -e "console.log('Health check passed')" || exit 1
|
||||
|
||||
# Expose port (for HTTP interface if needed)
|
||||
EXPOSE 3000
|
||||
|
||||
# Environment variables
|
||||
ENV NODE_ENV=production
|
||||
ENV CUDAQ_DEFAULT_TARGET=qpp-cpu
|
||||
ENV LOG_LEVEL=info
|
||||
ENV PYTHONPATH=/app/python
|
||||
|
||||
# Start command
|
||||
CMD ["node", "dist/index.js"]
|
||||
Referencia en una nueva incidencia
Block a user