Dockerfile 815 B

1234567891011121314151617181920212223242526
  1. # This Dockerfile is used to deploy a simple single-container Reflex app instance.
  2. FROM python:3.13
  3. RUN apt-get update && apt-get install -y redis-server && rm -rf /var/lib/apt/lists/*
  4. ENV REDIS_URL=redis://localhost PYTHONUNBUFFERED=1
  5. # Copy local context to `/app` inside container (see .dockerignore)
  6. WORKDIR /app
  7. COPY . .
  8. # Install app requirements and reflex in the container
  9. RUN pip install -r requirements.txt
  10. # Deploy templates and prepare app
  11. RUN reflex init
  12. # Download all npm dependencies and compile frontend
  13. RUN reflex export --frontend-only --no-zip
  14. # Needed until Reflex properly passes SIGTERM on backend.
  15. STOPSIGNAL SIGKILL
  16. # Always apply migrations before starting the backend.
  17. CMD [ -d alembic ] && reflex db migrate; \
  18. redis-server --daemonize yes && \
  19. exec reflex run --env prod