Improve Dockerfile efficiency and add Docker build instructions for contributors
Summary
This PR improves the DockerSlim contributor experience by optimizing the Dockerfiles and adding clear Docker build instructions to the README.
Changes Included
Updated build/package/docker/Dockerfile
- Removed
apk update && apk upgradeto follow best practices - Added OCI-standard metadata labels
- Added WORKDIR for clarity
- Cleaned up layers for more efficient caching
- Simplified and modernized build steps
Updated build/package/docker/Dockerfile.arm
- Applied the same improvements for consistency across architectures
- Ensures both x86 and ARM builds follow modern Docker guidance
Added new "Building Slim from the Provided Dockerfiles" section to README
- Shows how to build the Slim runtime images locally
- Includes x86 and ARM64 build examples
- Shows how to mount Docker socket to run Slim inside a container
- Includes rebuild-without-cache instructions
- Helps new contributors and users understand how to test their changes with Docker
Why This Change Is Useful
These changes improve consistency, security, and contributor onboarding:
- Faster and more reproducible Docker builds
- Cleaner images with fewer unnecessary layers
- Clear documentation for contributors who want to build/run Slim via Docker
- ARM64 and x86 instructions unified
Testing
All changes tested locally on macOS (Docker Desktop).
Verified that both Dockerfiles build successfully and Slim runs inside the container.
Thanks for reviewing! Happy to make adjustments if needed.
@TSDPRASAD88 I like the main idea and the key value introduced with this PR, eliminating lots of files from the docker context when the container images for the app get created.
One specific thing I'm concerned about is the fact that .dockerignore has entries for dist_linux/ and dist_linux_arm64/ where the binaries copied to the container image live.
I'm also curious why the selected approach is better than what's there already that excludes everything and then reincludes only what's needed:
**
!dist_linux/**
!dist_linux_arm64/**
!build/package/docker/.ds.container.d3e2c84f976743bdb92a7044ef12e381
Also curious if you used AI for the PR :-)