Files
dav-imap-mcp/Dockerfile
Yigit Colakoglu a2104917fd
All checks were successful
Build And Test / publish (push) Successful in 48s
Add /health endpoint for Docker healthcheck
The healthcheck was hitting /mcp which requires auth, causing unhealthy status.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-30 16:42:38 -08:00

43 lines
1.1 KiB
Docker

FROM python:3.12-slim
# Set environment variables
ENV PYTHONDONTWRITEBYTECODE=1 \
PYTHONUNBUFFERED=1 \
PIP_NO_CACHE_DIR=1 \
PIP_DISABLE_PIP_VERSION_CHECK=1
# Install gosu for stepping down from root
RUN apt-get update && apt-get install -y --no-install-recommends gosu \
&& rm -rf /var/lib/apt/lists/*
# Create non-root user
RUN groupadd -r mcp && useradd -r -g mcp mcp
# Set working directory
WORKDIR /app
# Install dependencies
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
# Copy application code
COPY src/ ./src/
# Copy entrypoint script
COPY entrypoint.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh
# Create data directory for SQLite
RUN mkdir -p /data && chown -R mcp:mcp /data /app
# Expose port
EXPOSE 8000
# Health check
HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \
CMD python -c "import urllib.request; urllib.request.urlopen('http://localhost:8000/health')" || exit 1
# Use entrypoint to fix permissions, then run as mcp user
ENTRYPOINT ["/entrypoint.sh"]
CMD ["gosu", "mcp", "python", "src/server.py"]