I am deploying my application using docker container. While I build and test the docker image in the local, It works perfectly fine. But when I deploy it to the Azure server I get Bad Gateway error. I though this might be due to CORS issue and learned from community discussions to use .streamlit folder and reference the 2 line code in the Dockerfile, so the issue might be resolved.
RUN mkdir ~/.streamlit
RUN cp .streamlit/config.prod.toml ~/.streamlit/config.toml
I had copied these files to my project folder. But while building the docker image, I get this below error.
=> ERROR [7/7] RUN cp .streamlit/config.prod.toml ~/.streamlit/config.toml 0.3s ------ > [7/7] RUN cp .streamlit/config.prod.toml ~/.streamlit/config.toml: #11 0.227 cp: cannot stat '.streamlit/config.prod.toml': No such file or directory ------ failed to solve with frontend dockerfile.v0: failed to build LLB: executor failed running [/bin/sh -c cp .streamlit/config.prod.toml ~/.streamlit/config.toml]: runc did not terminate sucessfully
This is my folder structure.
I also tried moving .streamlit folder to same location of the Dockerfile. But it didn’t work for me.
I also tried the other workarounds suggested in the community by changing docker file CMD to
streamlit run my_app.py --server.enableCORS=false streamlit run my_app.py --server.enableWebsocketCompression=false
But still getting the same error.
502 Bad Gateway nginx/1.17.8
FROM python:3.7 ENV PYTHONUNBUFFERED 1 COPY ./requirements.txt /requirements.txt RUN pip install --trusted-host pypi.org --trusted-host pypi.python.org --trusted-host files.pythonhosted.org -r /requirements.txt COPY ./app /app WORKDIR /app # streamlit-specific commands #RUN mkdir ~/.streamlit #RUN cp .streamlit/config.prod.toml ~/.streamlit/config.toml EXPOSE 80 CMD streamlit run main.py --server.enableWebsocketCompression=false
Can someone help me where Exactly I am missing.