I am trying to run a dash app with docker. When I run my app locally (without docker) the css stylesheet is recognized correctly. Running the dash app with docker results in the default style without applying the changes specified in the stylesheet.
My Dockerfile looks as following:
FROM python:3.9
ENV APP_HOME /app
WORKDIR $APP_HOME
COPY static app.py requirements.txt ./
RUN apt-get update
RUN apt-get install ffmpeg libsm6 libxext6 -y
RUN pip install -r requirements.txt
EXPOSE 8080
CMD python app.py
app.py contains the dash app, while the stylesheet is located in the folder ‘static’.
Currently I load the stylesheet like this:
Are you installing flask or gunicorn or waitress or some kind of server to serve up the app? Wondering if dash doesn’t know how to find it’s assets. Not sure if that’s in your requirements.txt. file.
Did you try putting the style.css file in a folder called assets instead of static? Minor thing but just to rule some stuff out since thats dash’s default css/image folder.
For reference sake, this is how i have my docker set up if it helps:
Hey,
thanks for your answer! I am using gunicorn and initially set up the static folder because I was deploying to aws. The problem was that somehow the contents of the folder did not get copied and therefore the stylesheet was not available. Changing my Dockerfile to the following did the trick.