diff --git a/doc/apps/vizro.md b/doc/apps/vizro.md index 0d8b31be..c6916075 100644 --- a/doc/apps/vizro.md +++ b/doc/apps/vizro.md @@ -32,18 +32,16 @@ You can get started quickly using our [template repository](https://github.com/p Your `app.py` should initialize the Vizro application as follows: ```python -import vizro as vm +import vizro.models as vm from vizro import Vizro # Initialize your dashboard +page = vm.Page(...) dashboard = vm.Dashboard(pages=[page]) # Create the application instance app = Vizro().build(dashboard) -# Expose the Flask server to Gunicorn -server = app.dash.server - # Development server (optional) if __name__ == "__main__": app.run() @@ -51,7 +49,12 @@ if __name__ == "__main__": 2. Dependencies File (`requirements.txt`) -List all Python packages required by your application. +List all Python packages required by your application. These should include pinned versions of `vizro` and `gunicorn`: + +``` +vizro==0.1.29 +gunicorn==23.0.0 +``` 3. `Dockerfile` @@ -64,14 +67,14 @@ WORKDIR /app # Install dependencies COPY requirements.txt . -RUN pip install --no-cache-dir -r requirements.txt gunicorn vizro +RUN pip install --no-cache-dir -r requirements.txt # Copy application files COPY . . # Configure the container EXPOSE 80 -ENTRYPOINT ["gunicorn", "app:server", "run", "--bind", "0.0.0.0:80"] +ENTRYPOINT ["gunicorn", "app:app", "--bind", "0.0.0.0:80"] ``` ## Testing locally diff --git a/examples/docker/vizro/Dockerfile b/examples/docker/vizro/Dockerfile index 6af91596..3cb85778 100644 --- a/examples/docker/vizro/Dockerfile +++ b/examples/docker/vizro/Dockerfile @@ -1,24 +1,14 @@ FROM python:3.11-slim -# Set environment variables -ENV PYTHONUNBUFFERED=1 \ - PYTHONDONTWRITEBYTECODE=1 \ - PIP_NO_CACHE_DIR=off \ - PIP_DISABLE_PIP_VERSION_CHECK=on - -# Set work directory WORKDIR /app -# Install Python dependencies -RUN pip install gunicorn +# Install dependencies COPY requirements.txt . RUN pip install --no-cache-dir -r requirements.txt -# Copy project files +# Copy application files COPY . . -# Expose the port -EXPOSE 8000 - -# Run the application using Gunicorn -ENTRYPOINT ["gunicorn", "app:server", "run", "--bind", "0.0.0.0:80"] +# Configure the container +EXPOSE 80 +ENTRYPOINT ["gunicorn", "app:app", "--bind", "0.0.0.0:80"] diff --git a/examples/docker/vizro/app.py b/examples/docker/vizro/app.py index ba378f7f..1380095c 100644 --- a/examples/docker/vizro/app.py +++ b/examples/docker/vizro/app.py @@ -17,7 +17,6 @@ dashboard = vm.Dashboard(pages=[page]) app = Vizro().build(dashboard) -server = app.dash.server if __name__ == "__main__": app.run() diff --git a/examples/docker/vizro/requirements.txt b/examples/docker/vizro/requirements.txt index 6f996cb0..faa56039 100644 --- a/examples/docker/vizro/requirements.txt +++ b/examples/docker/vizro/requirements.txt @@ -1 +1,2 @@ vizro==0.1.29 +gunicorn==23.0.0