Dockerfile•1.41 kB
# Use Python 3.10 slim image for smaller size
FROM python:3.10-slim
# Set environment variables
ENV PYTHONUNBUFFERED=1 \
PYTHONDONTWRITEBYTECODE=1 \
PIP_NO_CACHE_DIR=1 \
PIP_DISABLE_PIP_VERSION_CHECK=1 \
FASTMCP_LOG_LEVEL=INFO
# Create non-root user for security
RUN groupadd --gid 1000 appuser && \
useradd --uid 1000 --gid appuser --shell /bin/bash --create-home appuser
# Set working directory
WORKDIR /app
# Install system dependencies
RUN apt-get update && apt-get install -y \
gcc \
g++ \
libxml2-dev \
libxslt-dev \
&& rm -rf /var/lib/apt/lists/* \
&& apt-get clean
# Copy requirements first for better Docker layer caching
COPY pyproject.toml README.md LICENSE ./
# Install Python dependencies
RUN pip install --no-cache-dir --upgrade pip && \
pip install --no-cache-dir -e .
# Copy the application code
COPY french_tax_mcp/ ./french_tax_mcp/
# Change ownership to non-root user
RUN chown -R appuser:appuser /app
# Switch to non-root user
USER appuser
# Create cache directory
RUN mkdir -p /home/appuser/.french_tax_mcp_cache
# Expose the port
EXPOSE 8888
# Health check
HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \
CMD python -c "import httpx; httpx.get('http://localhost:8888/health', timeout=5)" || exit 1
# Run the server
CMD ["python", "-m", "french_tax_mcp.server", "--port", "8888", "--streamable-http"]