hackforla / hackforla/peopledepot
Optimize Dockerfile-aws with multi-stage build
- Dominant language
- Python
- Stars
- 14
- Forks
- 37
- Avg merge
- 9d 15h
- Merged PRs (30d)
- 5
Description
### Overview
Refactor `Dockerfile-aws` to use a multi-stage build to reduce the final production image size. This removes build-time dependencies and temporary files that don't need to be in the final image.
### Action Items
- [ ] Refactor `app/Dockerfile-aws` to use a multi-stage build:
- [ ] Stage 1: Builder stage that installs dependencies and runs `collectstatic`
- [ ] Stage 2: Runtime stage that copies only what's needed from the builder
- [ ] Remove build artifacts and cache from the final image
- [ ] Compare final image sizes before and after optimization
- [ ] Test that the optimized image builds successfully and the app runs correctly
- [ ] Document any image size improvements
### Acceptance Criteria
- Multi-stage build is implemented in `Dockerfile-aws`
- Final image size is smaller than the single-stage version
- App starts and serves static files correctly in the optimized image
- Build process completes without errors
- Image size comparison is documented (in commit message or PR description)
### References
- [Docker multi-stage builds](https://docs.docker.com/build/building/multi-stage/)
- We're not sure how much this will reduce the image size, since we already have method to remove build caches from the image.
**Parent Issue**: #219
**Blocked by**: #219 sub-issue "Add gunicorn and Whitenoise, and set up Dockerfile-aws and entrypoint-aws.sh"
Contributor guide
Assessment
This issue has not been assessed yet.