Hello everyone,
I’m having trouble deploying a Streamlit app as a Docker image to an Azure Web App. I keep getting a message saying “Please Wait…”, even though Streamlit should only display a heading (which I tried for testing purposes).
I’ve done an extensive internet search and read a lot about it, but I haven’t found a consistent approach to fix this issue, so nothing has worked so far.
Here’s a brief overview:
- It’s a Python 3.10 application.
- The Docker container works locally.
- I’ve created an Azure Container Registry (with basic pricing) and pushed the local Docker image there.
- An Azure Web App for Containers has been created (with B1 pricing and the Docker image previously created in ACR; unfortunately, there’s no SSH option included, at least according to the settings).
- Additionally, I’ve set the environment variable WEBSITES_PORT=8501 (which is also set in the Dockerfile with “EXPOSE 8501”).
I’ve tried adjusting some settings in Streamlit (server.address=“0.0.0.0”, server.folderWatchBlacklist=, server.enableCORS=false, server.enableXrsfProtection=false, server.enableWebsocketCompression=false) and on the Azure Web App side (set “Always On” to True), but unfortunately, everything has been unsuccessful.
I’m at a loss for what to do next and would appreciate any help.
Thank you very much and best regards,
Mario
Dockerfile:
# Use Python 3.10 base image
FROM python:3.10
# Set the working directory in the Docker container
WORKDIR /app
# Copy the contents of the 'src', 'assets', and 'documents' directories to the Docker container
COPY src/ ./
# Install Python dependencies
RUN pip install -r requirements.txt
# Expose the port Streamlit runs on
EXPOSE 8501
# Command to run the app
CMD ["streamlit", "run", "main.py"]