All checks were successful
Build And Test / publish (push) Successful in 47s
Container runs as non-root user but mounted volumes may be owned by root. Added entrypoint script to fix /data permissions before starting the app. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
43 lines
1.1 KiB
Docker
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/mcp')" || exit 1
|
|
|
|
# Use entrypoint to fix permissions, then run as mcp user
|
|
ENTRYPOINT ["/entrypoint.sh"]
|
|
CMD ["gosu", "mcp", "python", "src/server.py"]
|