Spaces:
Sleeping
Sleeping
File size: 2,073 Bytes
c75526e | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 | # Multi-stage build for optimized Docker image
FROM python:3.11-slim as python-base
# Set environment variables
ENV PYTHONUNBUFFERED=1 \
PYTHONDONTWRITEBYTECODE=1 \
PIP_NO_CACHE_DIR=1 \
PIP_DISABLE_PIP_VERSION_CHECK=1
# Install system dependencies
RUN apt-get update && apt-get install -y --no-install-recommends \
git \
curl \
wget \
ca-certificates \
openjdk-17-jre-headless \
&& rm -rf /var/lib/apt/lists/*
# Install Docker CLI (for building images)
RUN curl -fsSL https://download.docker.com/linux/debian/gpg | gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg \
&& echo "deb [arch=amd64 signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/debian bullseye stable" > /etc/apt/sources.list.d/docker.list \
&& apt-get update && apt-get install -y --no-install-recommends docker-ce-cli \
&& rm -rf /var/lib/apt/lists/*
# Install Nextflow
RUN curl -s https://get.nextflow.io | bash \
&& mv nextflow /usr/local/bin/ \
&& chmod +x /usr/local/bin/nextflow
# Install Viash
RUN curl -fsSL get.viash.io | bash -s -- --bin /usr/local/bin
# Create non-root user
RUN useradd --create-home --shell /bin/bash openproblems
# Set working directory
WORKDIR /app
# Copy requirements and install Python dependencies
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
# Copy the application
COPY src/ ./src/
COPY pyproject.toml ./
# Install the package
RUN pip install -e .
# Create necessary directories
RUN mkdir -p /app/logs /app/data /app/work \
&& chown -R openproblems:openproblems /app
# Switch to non-root user
USER openproblems
# Set environment variables for the user
ENV PATH="/home/openproblems/.local/bin:$PATH"
# Expose the default MCP port (not required for stdio but useful for HTTP transport)
EXPOSE 8000
# Health check
HEALTHCHECK --interval=30s --timeout=30s --start-period=5s --retries=3 \
CMD python -c "import mcp; print('MCP SDK available')" || exit 1
# Default command
CMD ["python", "-m", "mcp_server.main"]
|