AWS S3 Local Development CI/CD Setup That Actually Works
说明与用途
使用 Docker Compose 和 GitHub Actions 的 floci/local-aws 本地 S3 模拟器,提供一致的本地和生产环境,配置极简。
问题
Developers need a local S3‑compatible service that integrates with CI/CD and behaves like production, but most emulators require complex configuration.
结果
The setup starts in ~3 s, uses ~50 MB memory, and achieves 99.9 % reliability in production tests, eliminating configuration drift between local and production.
工作流
- 1. Create docker-compose.yml with floci/local-aws and expose ports 4566/4572.
- 2. Mount ./data:/data for persistence and set AWS credentials and region env vars.
- 3. Build application service that depends on local‑aws and sets AWS_ENDPOINT_URL to http://local-aws:4566.
- 4. In GitHub Actions, define a service using floci/local-aws image and expose port 4566.
- 5. Checkout code, set up Node.js, install dependencies, and run tests with AWS env vars pointing to localhost:4566.
- 6. Verify tests pass locally and in CI.
- 7. (Optional) Configure CORS on local bucket for browser uploads.
- 8. Persist data across restarts via volume mapping.
证据
Zero config for the emulator
Startup time ~3 seconds for the full stack
Reliability 99.9% uptime in production testing
- 记录日期: 2026-09-21T01:00:25.612Z