diff --git a/Dockerfile b/Dockerfile index 453e5b0..5bbbe38 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,12 +1,14 @@ # Generated by https://smithery.ai. See: https://smithery.ai/docs/config#dockerfile # Use a Python base image with hatchling for building -FROM python:3.11-slim as builder +# Edited by CultriX on 2025-05-14 (yy-mm-dd) + +FROM python:3.11-slim AS builder # Set work directory WORKDIR /app -# Install build system -RUN pip install hatchling +# Install build system with version pinning +RUN pip install --no-cache-dir pip==23.1.2 hatchling==1.18.0 build==1.0.3 # Copy project files COPY pyproject.toml README.md /app/ @@ -18,11 +20,26 @@ RUN python -m build # Use a separate environment for the final image FROM python:3.11-slim +# Set work directory WORKDIR /app -# Install the package +# Add a non-root user +RUN groupadd -r appuser && useradd -r -g appuser appuser + +# Copy .whl file from builder COPY --from=builder /app/dist/*.whl /app/ -RUN pip install /app/*.whl + +# Install .whl file and remove it to reduce image size +RUN pip install /app/*.whl && rm /app/*.whl + +# Expose the port your service listens on (adjust to your actual port) +# EXPOSE 8000 + +# Add healthcheck (adjust URL path as needed) +# HEALTHCHECK CMD curl --fail http://localhost:8000/health || exit 1 + +# Switch to non-root user +USER appuser # Define default command ENTRYPOINT ["python", "-m", "mcp_server_reddit"]