Spaces:
Paused
Paused
| # Stage 1: Build the frontend | |
| FROM node:lts-alpine AS frontend-builder | |
| WORKDIR /app/frontend | |
| # Install pnpm globally | |
| RUN npm install -g pnpm | |
| # Copy package.json and pnpm-lock.yaml first to leverage Docker cache | |
| COPY frontend/package.json frontend/pnpm-lock.yaml ./ | |
| # Install dependencies using pnpm | |
| RUN pnpm install --frozen-lockfile | |
| # Copy the rest of the frontend source code | |
| COPY frontend/ ./ | |
| # Build the frontend | |
| RUN pnpm build | |
| # Stage 2: Final Python application image | |
| FROM python:3.10-slim AS final | |
| WORKDIR /app | |
| # Install system dependencies including curl and openssl for diagnostics | |
| # Also update CA certificates | |
| RUN apt-get update && \ | |
| apt-get install -y --no-install-recommends curl openssl ca-certificates && \ | |
| update-ca-certificates && \ | |
| rm -rf /var/lib/apt/lists/* | |
| # Copy requirements.txt and install Python dependencies | |
| COPY requirements.txt ./ | |
| RUN pip install --no-cache-dir --upgrade pip && \ | |
| pip install --no-cache-dir -r requirements.txt | |
| # Create necessary directories | |
| RUN mkdir account | |
| RUN mkdir -p templates static | |
| # Copy application code and utils | |
| COPY run.py ./ | |
| COPY utils/ ./utils/ | |
| # Copy built frontend assets from the builder stage | |
| COPY --from=frontend-builder /app/frontend/dist/index.html ./templates/ | |
| COPY --from=frontend-builder /app/frontend/dist/* ./static/ | |
| # Expose the port the app runs on | |
| EXPOSE 5000 | |
| # --- TEMPORARY DIAGNOSTIC CMD --- | |
| # This CMD will run diagnostic commands before starting the Python application. | |
| # Their output will appear in the Hugging Face container logs. | |
| # REMEMBER TO REVERT THIS to CMD ["python", "run.py"] after diagnostics. | |
| CMD sh -c "\ | |
| echo '======================================================================'; \ | |
| echo '=== DIAGNOSTIC STEP 1: Testing msoauth2api.233285.xyz with curl ==='; \ | |
| echo '======================================================================'; \ | |
| curl -vvv --max-time 30 https://msoauth2api.233285.xyz/api/mail-new; \ | |
| echo; \ | |
| echo '======================================================================'; \ | |
| echo '=== DIAGNOSTIC STEP 2: Testing SSL/TLS connection with openssl ==='; \ | |
| echo '======================================================================'; \ | |
| echo | openssl s_client -connect msoauth2api.233285.xyz:443 -servername msoauth2api.233285.xyz -showcerts -msg 2>/dev/null; \ | |
| echo; \ | |
| echo '======================================================================'; \ | |
| echo '=== DIAGNOSTIC STEP 3: Testing DNS resolution for the host ==='; \ | |
| echo '======================================================================'; \ | |
| getent hosts msoauth2api.233285.xyz; \ | |
| echo; \ | |
| echo '======================================================================'; \ | |
| echo '=== DIAGNOSTICS COMPLETE - Starting Python application ==='; \ | |
| echo '======================================================================'; \ | |
| python run.py" | |
| # --- ORIGINAL CMD --- | |
| # After diagnostics, comment out the CMD above and uncomment the line below: | |
| # CMD ["python", "run.py"] |