Skip to content

Commit

Permalink
Add image waste analysis to the pipeline
Browse files Browse the repository at this point in the history
  • Loading branch information
burakince committed Dec 19, 2024
1 parent bf203d6 commit e7fbca7
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 4 deletions.
13 changes: 13 additions & 0 deletions .dive-ci
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
rules:
# If the efficiency is measured below X%, mark as failed.
# Expressed as a ratio between 0-1.
lowestEfficiency: 0.95

# If the amount of wasted space is at least X or larger than X, mark as failed.
# Expressed in B, KB, MB, and GB.
highestWastedBytes: 20MB

# If the amount of wasted space makes up for X% or more of the image, mark as failed.
# Note: the base image layer is NOT included in the total image size.
# Expressed as a ratio between 0-1; fails if the threshold is met or crossed.
highestUserWastedPercent: 0.20
8 changes: 7 additions & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,19 @@
.env
.isort.cfg
.flake8
.editorconfig
.gitattributes
.gitignore
.dive-ci

# Files
LICENSE
README.md
artifacthub-repo.yml
docker-compose.*.yaml
*.md

# Folders
test-containers
tests
mlflowstack
docs
9 changes: 9 additions & 0 deletions .github/workflows/docker-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,15 @@ jobs:
# if: ${{ steps.docker-image-scan.outcome == 'failure' }}
# run: exit 1

- name: Install Dive
run: |
DIVE_VERSION=$(curl -sL "https://api.github.com/repos/wagoodman/dive/releases/latest" | grep '"tag_name":' | sed -E 's/.*"v([^"]+)".*/\1/')
curl -OL https://github.com/wagoodman/dive/releases/download/v${DIVE_VERSION}/dive_${DIVE_VERSION}_linux_amd64.deb
sudo apt install ./dive_${DIVE_VERSION}_linux_amd64.deb
- name: Analyse Efficiency and Wastes on Image
run: dive docker.io/${{ env.IMAGE_NAME }}:latest

# Build again and push Docker image with Buildx (don't push on PR)
# https://github.com/docker/build-push-action
- name: Build and push Docker image
Expand Down
4 changes: 1 addition & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,6 @@ RUN apt-get update && \
liblzma-dev && \
apt-get clean && rm -rf /var/lib/apt/lists/*

RUN ln -s /usr/bin/llvm-config-9 /usr/bin/llvm-config

RUN python -m pip install --upgrade pip

RUN pip install poetry wheel && \
Expand All @@ -42,7 +40,7 @@ FROM python:3.12.8-slim

WORKDIR /mlflow/

COPY --from=foundation /mlflow /mlflow
COPY --from=foundation /mlflow/.venv /mlflow/.venv

ENV PATH=/mlflow/.venv/bin:$PATH

Expand Down

0 comments on commit e7fbca7

Please sign in to comment.