Error deploying static Docker

Hello everyone,

i’m facing the following problem, I have a streamlit app which i want to deploy in a kubernetes cluster. to do that I containerized in a docker Image which looks like the following

FROM continuumio/miniconda3:23.10.0-1 as build

WORKDIR /app

COPY . .
COPY .streamlit/ .streamlit/

RUN apt-get update &&
apt-get install -y build-essential ca-certificates libssl-dev libasound2 wget curl sudo nginx &&
wget -O - https://www.openssl.org/source/openssl-1.1.1u.tar.gz | tar zxf - &&
cd openssl-1.1.1u &&
./config --prefix=/usr/local &&
make -j $(nproc) &&
make install_sw install_ssldirs &&
ldconfig -v &&
cd …/ &&
rm -rf openssl-1.1.1u &&
apt-get install -y wget # Install wget here

ENV SSL_CERT_DIR=/etc/ssl/certs
ENV SSL_CERT_FILE=/etc/pki/tls/certs/ca-bundle.crt

RUN conda env update -n base -f environment_base.yml &&
rm /app/environment_base.yml &&
conda clean -ya

RUN rm /etc/nginx/sites-enabled/default
COPY nginx.conf /etc/nginx/sites-enabled/

RUN ls -l /app

EXPOSE 8502
HEALTHCHECK CMD curl --fail http://localhost:8502/_stcore/health
CMD service nginx start && streamlit run sac_chatbot_fe.py --server.port=8502 --server.address=0.0.0.0 --server.enableCORS false --server.enableXsrfProtection false

In the .streamlit/config.toml file i have the following

[server]
headless = true
port = 8502
enableXsrfProtection = false
enableWebsocketCompression = false
enableCORS = false
enableStaticServing = true

[browser]
gatherUsageStats = false

and in the nginx.conf file i have the following

server {
listen 80;
listen 443;
location / {
proxy_pass http://0.0.0.0:8502;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}

the problem that I’m facing right now is that the image is being deployed in a Kubernetes cluster, when I access the directly the IP of the pod where the image is running I can access the app without problem but when I try to do it using the sub-domain of the company where it’s deployed. the static files are not being serve, hence I only see a blank page


Any Idea what could be happening?

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.