Dockerfile 629 B

123456789101112131415161718192021
  1. # This Dockerfile is used to deploy a simple single-container Reflex app instance.
  2. FROM python:3.11
  3. # Copy local context to `/app` inside container (see .dockerignore)
  4. WORKDIR /app
  5. COPY . .
  6. # Install app requirements and reflex in the container
  7. RUN pip install -r requirements.txt
  8. # Deploy templates and prepare app
  9. RUN reflex init
  10. # Download all npm dependencies and compile frontend
  11. RUN reflex export --frontend-only --no-zip
  12. # Needed until Reflex properly passes SIGTERM on backend.
  13. STOPSIGNAL SIGKILL
  14. # Always apply migrations before starting the backend.
  15. CMD [ -d alembic ] && reflex db migrate; reflex run --env prod