I deploy a FastAPI service with docker (see my docker-compose.yml and app).

My service directory gets filled with files index.html, index.html.1, index.html.2,… that all contain

They seem to be generated any time the docker healthcheck pings the service.

How can I get rid of these?

PS: I had to put a screenshot, because Lemmy stripped my HTML in the code quote.

    • taaz@biglemmowski.win
      link
      fedilink
      English
      arrow-up
      0
      ·
      edit-2
      9 months ago

      That’s weird, I have never noticed any kind of .html files generation when accessing the docs and I have worked with F.Api for some time now, also can’t seem to find ang mention of this generation in the docs (that it actually writes files).

      Also isn’t the default doc path /docs (/redoc)

      • Martín@lemmy.worldOP
        link
        fedilink
        arrow-up
        0
        ·
        edit-2
        9 months ago

        Ok, that was stupid. Doing healthcheck with wget, does what wget does: it downloads the result. I had to add --spider to stop doing that

          wget -nv --spider http://localhost:8000 || exit 1
        
  • unalivejoy@lemm.ee
    link
    fedilink
    English
    arrow-up
    0
    ·
    9 months ago

    In your docker-compose.yml file, your healthcheck for fastapi uses wget, which saves the file to disk by default. Add --spider to make it behave correctly. Your nginx service has the correct command.