A service that generates optimized Dockerfiles based on project requirements.
- AWS Lambda (Container Runtime)
- Amazon API Gateway
- Amazon ECR
- Amazon S3
- Terraform Cloud
- AWS Account
- Terraform Cloud Account
- Docker installed locally
- Python 3.11+
- Poetry for Python dependency management
- Install dependencies:
poetry install
- Set up environment variables:
export AWS_ACCESS_KEY_ID="your_access_key"
export AWS_SECRET_ACCESS_KEY="your_secret_key"
export AWS_REGION="your_region"
export AWS_ACCOUNT_ID="your_account_id"
- Initialize Terraform:
cd aws_resources
terraform init
The project uses Terraform Cloud for infrastructure management. Deployments are automated through GitHub integration.
If you want to deploy through the Terraform Cloud UI, you can do so by following these steps:
- Create a new workspace in Terraform Cloud
- Add the GitHub repository to the workspace
- Create a new variable set in the workspace and add the AWS credentials as variables
- Run the plan and apply buttons in the Terraform Cloud UI
- Push changes to GitHub
- Terraform Cloud automatically plans and applies changes
- New Docker image is built and pushed to ECR
- Lambda function is updated with the latest image
curl -X POST https://api.example.com/prod/generate-dockerfile \
-H "x-api-key: your_api_key" \
-H "Content-Type: application/json" \
-d '{
"config": {
"language": "python",
"dependency_stack": "Django",
"extra_dependencies": ["pandas", "numpy"],
"language_version": "3.11"
}
}'
├── aws_resources/ # Terraform infrastructure code
├── docker_templates/ # Dockerfile templates
├── generate_dockerfile.py # Main Lambda function
├── pyproject.toml # Python dependencies
└── README.md
- API Gateway: Regional endpoint with API key authentication
- Lambda: Container-based function with 30s timeout
- S3: Private bucket for Dockerfile storage
- ECR: Container registry for Lambda images
- IAM: Least-privilege access policies
- Fork the repository
- Create a feature branch
- Commit your changes
- Push to the branch
- Create a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
- S3 bucket with public access blocked
- IAM role-based access control
- API Gateway with usage plans and API keys
- ECR repository with specific permissions