slimtoolkit / slimtoolkit/slim

`slim build` doesn't generate optimized Dockerfile

Open
#589 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Go
Stars
23.4k
Forks
841
PR merge metrics
No merged PRs in 30d

Description

Expected Behavior

In addition to a minified Docker image, get an optimized Dockerfile that you can reuse to build new images.


Actual Behavior

The minified Docker image is created, but the optimized Dockerfile isn't. These are the only artifacts coming out of slim build:

  • my_docker_image-apparmor-profile
  • my_docker_image-seccomp.json
  • Dockerfile.fat
  • creport.json
  • files.tar

However, the optimized Dockerfile appears in slim build's logs:

cmd=build state=completed
cmd=build info=results status='MINIFIED' by='2.31X' size.original='18 GB' size.optimized='8.0 GB' 
cmd=build info=results image.name='my_docker_image' image.size='8.0 GB' has.data='true' 
cmd=build info=results artifacts.location='/tmp/slim-state/.slim-state/images/90bac9eb9682b042575a70af22e86057a94c09dd1bbbc52e1975954954e002d1/artifacts' 
cmd=build info=results artifacts.report='creport.json' 
cmd=build info=results artifacts.dockerfile.reversed='Dockerfile.fat' 
cmd=build info=results artifacts.dockerfile.optimized='Dockerfile' 
cmd=build info=results artifacts.seccomp='my_docker_image-seccomp.json' 
cmd=build info=results artifacts.apparmor='my_docker_image-apparmor-profile' 
cmd=build state=done

Steps to Reproduce the Problem

  1. Run slim xray on a Docker image to get a report.json file
  2. Run slim build passing report.json and targeting the Docker image you want to minify/optimize

Specifications

  • Version: linux|Transformer|1.40.4|d310b07567dc90763f5f27f94c618f057295b55d|2023-08-26_01:39:22AM
  • Platform: Ubuntu 20.04.5 LTS

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at the slim build entry point and trace how the artifacts directory reported in the logs is populated when report.json is supplied. Compare the handling of Dockerfile.fat with the optimized Dockerfile; done means the optimized Dockerfile is present among the generated artifacts after the documented reproduction steps.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker, go
Domain
build-system, devops
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.