| FROM python:3.9 | |
| # Create user | |
| RUN useradd -m -u 1000 user | |
| # Set workdir and env | |
| WORKDIR /app | |
| ENV PATH="/home/user/.local/bin:$PATH" | |
| # Copy requirements file first | |
| COPY requirements/requirement.txt ./requirements.txt | |
| COPY lib/ ./lib/ | |
| RUN pwd | |
| RUN ls | |
| # Install deps as root | |
| RUN pip install --no-cache-dir --upgrade -r requirements.txt | |
| # Switch to non-root user | |
| USER user | |
| # Copy the app | |
| COPY --chown=user src/ . | |
| # Optional: debug | |
| RUN ls -la /app | |
| # Run the app | |
| CMD ["waitress-serve", "--host=0.0.0.0", "--port=7860", "main:app1"] |