Fix API Dockerfile to use requirements.txt and correct port
Fixed Dockerfile to properly install all dependencies from requirements.txt instead of hardcoding them, and corrected the port from 8001 to 8080. Issues Fixed: 1. ModuleNotFoundError: No module named 'httpx' - Dockerfile was hardcoding pip install - httpx was missing from hardcoded dependencies 2. Port mismatch - Dockerfile was exposing port 8001 - Application uses port 8080 Changes: - Copy requirements.txt before installing - Use pip install -r requirements.txt - Changed EXPOSE from 8001 to 8080 - Changed CMD port from 8001 to 8080 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -2,15 +2,18 @@ FROM python:3.11-slim
|
|||||||
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
# Install dependencies
|
# Copy requirements first for better caching
|
||||||
RUN pip install --no-cache-dir fastapi uvicorn[standard] pydantic
|
COPY requirements.txt .
|
||||||
|
|
||||||
|
# Install dependencies from requirements.txt
|
||||||
|
RUN pip install --no-cache-dir -r requirements.txt
|
||||||
|
|
||||||
# Copy application
|
# Copy application
|
||||||
COPY db.json .
|
COPY db.json .
|
||||||
COPY main.py .
|
COPY main.py .
|
||||||
|
|
||||||
# Expose port
|
# Expose port
|
||||||
EXPOSE 8001
|
EXPOSE 8080
|
||||||
|
|
||||||
# Run the application
|
# Run the application
|
||||||
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8001"]
|
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8080"]
|
||||||
|
|||||||
Reference in New Issue
Block a user