Skip to content

Commit

Permalink
[Tidy] Reduce the image size of UI for chart (#701)
Browse files Browse the repository at this point in the history
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
  • Loading branch information
lingyielia and pre-commit-ci[bot] authored Sep 13, 2024
1 parent 2c1d95e commit 390ff2b
Show file tree
Hide file tree
Showing 4 changed files with 149 additions and 48 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
<!--
A new scriv changelog fragment.
Uncomment the section that is right (remove the HTML comment wrapper).
-->

<!--
### Highlights ✨
- A bullet item for the Highlights ✨ category with a link to the relevant PR at the end of your entry, e.g. Enable feature XXX ([#1](https://github.com/mckinsey/vizro/pull/1))
-->
<!--
### Removed
- A bullet item for the Removed category with a link to the relevant PR at the end of your entry, e.g. Enable feature XXX ([#1](https://github.com/mckinsey/vizro/pull/1))
-->
<!--
### Added
- A bullet item for the Added category with a link to the relevant PR at the end of your entry, e.g. Enable feature XXX ([#1](https://github.com/mckinsey/vizro/pull/1))
-->
<!--
### Changed
- A bullet item for the Changed category with a link to the relevant PR at the end of your entry, e.g. Enable feature XXX ([#1](https://github.com/mckinsey/vizro/pull/1))
-->
<!--
### Deprecated
- A bullet item for the Deprecated category with a link to the relevant PR at the end of your entry, e.g. Enable feature XXX ([#1](https://github.com/mckinsey/vizro/pull/1))
-->
<!--
### Fixed
- A bullet item for the Fixed category with a link to the relevant PR at the end of your entry, e.g. Enable feature XXX ([#1](https://github.com/mckinsey/vizro/pull/1))
-->
<!--
### Security
- A bullet item for the Security category with a link to the relevant PR at the end of your entry, e.g. Enable feature XXX ([#1](https://github.com/mckinsey/vizro/pull/1))
-->
41 changes: 41 additions & 0 deletions vizro-ai/examples/dashboard_ui/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# Git
.git
.gitignore
.gitattributes

# Docker
Dockerfile
docker-compose.yml
.dockerignore

# Python
*.pyc
*.pyo
*.pyd
__pycache__
.pytest_cache
.coverage
htmlcov/
.tox/
.venv
venv/
*.egg-info/
dist/
build/

# Editors
.vscode/
.idea/
*.swp
*.swo

# OS generated
.DS_Store
Thumbs.db

# Application specific
*.log
*.sqlite3

# csv
*.csv
33 changes: 26 additions & 7 deletions vizro-ai/examples/dashboard_ui/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,17 +1,36 @@
# read the doc: https://huggingface.co/docs/hub/spaces-sdks-docker
# you will also find guides on how best to write your Dockerfile
FROM python:3.12-slim AS builder

FROM python:3.12
RUN apt-get update && apt-get install -y --no-install-recommends \
gcc \
&& rm -rf /var/lib/apt/lists/*

RUN useradd -m -u 1000 user
USER user
ENV HOME=/home/user \
PATH=/home/user/.local/bin:$PATH
WORKDIR $HOME/app

WORKDIR /app
COPY --chown=user requirements.txt .
RUN pip install --user --no-cache-dir --upgrade pip && \
pip install --user --no-cache-dir -r requirements.txt

COPY --chown=user ./requirements.txt requirements.txt
# Production stage
FROM python:3.12-slim

RUN pip install --no-cache-dir --upgrade -r requirements.txt
RUN apt-get update && apt-get upgrade -y && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*

COPY --chown=user . /app
RUN useradd -m -u 1000 user
USER user
ENV HOME=/home/user \
PATH=/home/user/.local/bin:$PATH
WORKDIR $HOME/app

COPY --from=builder --chown=user $HOME/.local/lib/python3.12/site-packages $HOME/.local/lib/python3.12/site-packages
COPY --from=builder --chown=user $HOME/.local/bin $HOME/.local/bin

COPY --chown=user . $HOME/app

EXPOSE 7860

Expand Down
Loading

0 comments on commit 390ff2b

Please sign in to comment.