Fix API Dockerfile to use requirements.txt and correct port
All checks were successful
Helm Chart Build / lint-only (push) Has been skipped
Helm Chart Build / build-helm (push) Successful in 8s
Build and Deploy / build-api (push) Successful in 39s
Build and Deploy / build-web (push) Successful in 59s

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:
d.viti
2025-10-09 17:29:47 +02:00
parent 6c4e40400a
commit 7a4c9eaacc

View File

@@ -2,15 +2,18 @@ FROM python:3.11-slim
WORKDIR /app
# Install dependencies
RUN pip install --no-cache-dir fastapi uvicorn[standard] pydantic
# Copy requirements first for better caching
COPY requirements.txt .
# Install dependencies from requirements.txt
RUN pip install --no-cache-dir -r requirements.txt
# Copy application
COPY db.json .
COPY main.py .
# Expose port
EXPOSE 8001
EXPOSE 8080
# 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"]