├── .gitignore ├── Dockerfile ├── app.py ├── docker-compose.yml ├── readme.md └── requirements.txt /.gitignore: -------------------------------------------------------------------------------- 1 | venv/* 2 | .idea/* 3 | **__pycache__** -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | FROM python:3.8-slim-buster 2 | 3 | # Create a working directory. 4 | RUN mkdir wd 5 | WORKDIR wd 6 | 7 | # Install Python dependencies. 8 | COPY requirements.txt . 9 | RUN pip3 install -r requirements.txt 10 | 11 | # Copy the rest of the codebase into the image 12 | COPY . ./ 13 | 14 | # Finally, run gunicorn. 15 | CMD [ "gunicorn", "--workers=5", "--threads=1", "-b 0.0.0.0:8000", "app:server"] 16 | -------------------------------------------------------------------------------- /app.py: -------------------------------------------------------------------------------- 1 | import dash 2 | import dash_html_components as html 3 | 4 | from flask import Flask 5 | 6 | server = Flask(__name__) 7 | app = dash.Dash(server=server) 8 | app.layout = html.Div("Hello world.") 9 | 10 | if __name__ == '__main__': 11 | app.run_server() 12 | -------------------------------------------------------------------------------- /docker-compose.yml: -------------------------------------------------------------------------------- 1 | # docker-compose.yml 2 | version: '3' 3 | networks: 4 | myapp-network: 5 | services: 6 | # main application 7 | myapp: 8 | container_name: myapp 9 | build: 10 | . 11 | ports: 12 | - "8000:8000" 13 | -------------------------------------------------------------------------------- /readme.md: -------------------------------------------------------------------------------- 1 | # Dash docker mwe 2 | 3 | This repository holds a minimal working example of how to run a Plotly Dash app via docker. 4 | 5 | ## Running the example 6 | 7 | The example can be run with a single command, 8 | 9 | docker-compose up 10 | 11 | Subsequently, the app can be accessed at, 12 | 13 | http://localhost:8000/ 14 | -------------------------------------------------------------------------------- /requirements.txt: -------------------------------------------------------------------------------- 1 | dash==1.12.0 2 | gunicorn 3 | flask 4 | --------------------------------------------------------------------------------