Streamlit, FastAPI Deployment Issue

Hi,

I am trying to deploy my application on Hugging Face with a FastAPI backend and Streamlit frontend. The application is containerized using Docker. The issue is that my Streamlit frontend is not launched when I run the application although the app works fine on my local system.

I am using the following command in my Dockerfile:

Expose the port that the application listens on.

EXPOSE 7860

Run the application.

CMD [“bash”, “-c”, “uvicorn main:app --host 0.0.0.0 --port 7860 & streamlit run myapp.py --server.port 8501”]

Can someone guide me how to troubleshoot this issue?

Hi there,
I have run into a similar issue but may be a little ahead of you. I have posted something similar at:
deploying-nginx-in-docker-with-streamlit-and-fastapi

A few tips:

  • It would help to post a link to your public project.
  • you will need to implement a reverse proxy like nginx to expose multiple services through docker. This is exactly what I am trying to do
  • instead of running the applications through a single CMD; try to use an ENDPOINT script. My project provides an example.

Good luck!