xvfb-run as container PID 1 hangs before exec'ing uvicorn — its Xvfb readiness handshake (SIGUSR1) is never delivered to PID 1, so the backend sat 'Up (unhealthy)' with no logs and the frontend never started. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
28 lines
858 B
Docker
28 lines
858 B
Docker
FROM python:3.11-slim
|
|
|
|
WORKDIR /app
|
|
|
|
RUN apt-get update && apt-get install -y \
|
|
build-essential \
|
|
libpq-dev \
|
|
postgresql-client \
|
|
curl \
|
|
xvfb \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
COPY requirements.txt .
|
|
RUN pip install --no-cache-dir -r requirements.txt
|
|
|
|
# Playwright + Chromium for Booking.com scraper
|
|
RUN playwright install chromium --with-deps
|
|
|
|
COPY . .
|
|
|
|
EXPOSE 8000
|
|
|
|
# Run under a virtual X display so Chromium launches headful (headful fingerprints
|
|
# far cleaner than headless — real GPU strings, plugins, chrome.runtime).
|
|
# Start Xvfb directly rather than via xvfb-run: as container PID 1, xvfb-run's
|
|
# SIGUSR1 readiness handshake never fires and it hangs without exec'ing the app.
|
|
ENV DISPLAY=:99
|
|
CMD ["/bin/sh", "-c", "Xvfb :99 -screen 0 1920x1080x24 -nolisten tcp & sleep 1; exec uvicorn main:app --host 0.0.0.0 --port 8000"]
|