apisix-docker
apisix-docker copied to clipboard
chore: optimize debian-dev Dockerfiles for better layer caching
Summary
- Optimize debian-dev/Dockerfile and debian-dev/Dockerfile.local for better Docker layer caching
- Copy only dependency-related files before full source code to improve cache hits on code changes
Changes
Layer Caching Optimization
- Dockerfile.local: Separate COPY steps - first copy Makefile, rockspec, .requirements, then run make deps, finally copy remaining source code
- This ensures make deps layer is cached when only application code changes
Brotli Build Improvement
- Move brotli compilation into Dockerfile as separate RUN layer (cached independently)
- Copy pre-built brotli from build stage instead of rebuilding in production stage
Cleanup
- Remove duplicate apt-get install libldap2-dev in production stage
- Fix ENV syntax (DEBIAN_FRONTEND=noninteractive instead of DEBIAN_FRONTEND noninteractive)
Benefits
- Faster rebuilds: Code-only changes no longer trigger full dependency reinstallation
- Smaller final image: Brotli build tools not installed in production stage
- Simpler maintenance: No external shell script dependency