{"id":31048958,"url":"https://github.com/degagne/docker-aws-lambda","last_synced_at":"2026-05-08T07:31:56.298Z","repository":{"id":310940237,"uuid":"1041828196","full_name":"degagne/docker-aws-lambda","owner":"degagne","description":"Amazon Web Services (AWS) Lambda Docker Images for Python","archived":false,"fork":false,"pushed_at":"2026-03-11T04:24:46.000Z","size":47,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-03-11T09:11:57.042Z","etag":null,"topics":["aws","aws-lambda-function","aws-lambda-python","aws-lamdba","docker","docker-compose","docker-image"],"latest_commit_sha":null,"homepage":"https://hub.docker.com/r/ddegagne/aws-lambda","language":"Dockerfile","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/degagne.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-08-21T04:31:35.000Z","updated_at":"2026-03-11T04:24:50.000Z","dependencies_parsed_at":"2025-09-04T05:31:18.853Z","dependency_job_id":null,"html_url":"https://github.com/degagne/docker-aws-lambda","commit_stats":null,"previous_names":["degagne/docker-aws-lambda"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/degagne/docker-aws-lambda","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/degagne%2Fdocker-aws-lambda","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/degagne%2Fdocker-aws-lambda/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/degagne%2Fdocker-aws-lambda/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/degagne%2Fdocker-aws-lambda/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/degagne","download_url":"https://codeload.github.com/degagne/docker-aws-lambda/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/degagne%2Fdocker-aws-lambda/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32770988,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-08T02:36:36.067Z","status":"ssl_error","status_checked_at":"2026-05-08T02:36:07.210Z","response_time":54,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["aws","aws-lambda-function","aws-lambda-python","aws-lamdba","docker","docker-compose","docker-image"],"created_at":"2025-09-14T21:25:07.941Z","updated_at":"2026-05-08T07:31:56.286Z","avatar_url":"https://github.com/degagne.png","language":"Dockerfile","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Amazon Web Services (AWS) Lambda Images for Python\n\n[![Docker Build and Push](https://github.com/degagne/docker-aws-lambda/actions/workflows/docker-ci.yml/badge.svg)](https://github.com/degagne/docker-aws-lambda/actions/workflows/docker-ci.yml)\n\n[![Dependency Vulnerabilities](https://img.shields.io/endpoint?url=https%3A%2F%2Fapi-hooks.soos.io%2Fapi%2Fshieldsio-badges%3FbadgeType%3DDependencyVulnerabilities%26pid%3D8y87rihef%26)](https://app.soos.io/research/repositories/github/degagne/docker-aws-lambda?attributionFormat=soosissues) [![Out Of Date Dependencies](https://img.shields.io/endpoint?url=https%3A%2F%2Fapi-hooks.soos.io%2Fapi%2Fshieldsio-badges%3FbadgeType%3DOutOfDateDependencies%26pid%3D8y87rihef%26)](https://app.soos.io/research/repositories/github/degagne/docker-aws-lambda?attributionFormat=soosissues)\n\nThis project provides Docker images for running Python-based AWS Lambda functions. It includes Dockerfiles\nand a docker-compose.yaml configuration to build and manage containerized environments for AWS Lambda using\nPython 3.10+. The project supports both standard and slim versions of the images, based on Alpine Linux, to \nensure lightweight and efficient containers.\n\n## Key Features:\n- **Python 3.10+ Runtime**: The images are tailored for AWS Lambda functions using Python 3.10+.\n- **Alpine Linux Base**: Utilizes Alpine Linux for minimal image size and security.\n- **Custom CA Certificates**: Supports adding custom CA certificates for secure communication.\n- **Lambda Runtime Interface Emulator**: Includes the AWS Lambda Runtime Interface Emulator for local testing.\n- **Multi-Stage Builds**: Uses multi-stage Docker builds to optimize image size and dependencies.\n- **Non-Root User**: Runs the container as a non-root user for enhanced security.\n- **Docker Compose Support**: Provides a docker-compose.yaml file for easy setup and management of services.\n\n## Tagging\n\nThe Docker images are tagged with the following format:\n\n```\n\u003cimage_name\u003e-\u003cpython_version\u003ealpine\u003cdistro_version\u003e-\u003cvariant\u003e\n```\n\n**Where**:\n- `\u003cimage_name\u003e`: The name of the image (e.g., `aws-lambda`).\n- `\u003cpython_version\u003e`: The version of Python (e.g., `3.10`, `3.11`).\n- `\u003cdistro_version\u003e`: The version of the Alpine Linux distribution (e.g., `3.22`, `3.23`).\n- `\u003cvariant\u003e`: The variant of the image (e.g., `slim`, `standard`).\n\n**Examples**:\n\n- `aws-lambda-3.10-alpine3.22-slim`\n- `aws-lambda-3.11-alpine3.22`\n- `aws-lambda-3.13-alpine3.21`\n\n### Supported Tags and `Dockerfile` Links\n\n- Python Runtime: 3.14\n  - [`3.14-alpine3.20`](3.14/Dockerfile)\n  - [`3.14-alpine3.20-slim`](3.14/Dockerfile.slim)\n  - [`3.14-alpine3.21`](3.14/Dockerfile)\n  - [`3.14-alpine3.21-slim`](3.14/Dockerfile.slim)\n  - [`3.14-alpine3.22`](3.14/Dockerfile)\n  - [`3.14-alpine3.22-slim`](3.14/Dockerfile.slim)\n- Python Runtime: 3.13\n  - [`3.13-alpine3.20`](3.13/Dockerfile)\n  - [`3.13-alpine3.20-slim`](3.13/Dockerfile.slim)\n  - [`3.13-alpine3.21`](3.13/Dockerfile)\n  - [`3.13-alpine3.21-slim`](3.13/Dockerfile.slim)\n  - [`3.13-alpine3.22`](3.13/Dockerfile)\n  - [`3.13-alpine3.22-slim`](3.13/Dockerfile.slim)\n- Python Runtime: 3.12\n  - [`3.12-alpine3.20`](3.12/Dockerfile)\n  - [`3.12-alpine3.20-slim`](3.12/Dockerfile.slim)\n  - [`3.12-alpine3.21`](3.12/Dockerfile)\n  - [`3.12-alpine3.21-slim`](3.12/Dockerfile.slim)\n  - [`3.12-alpine3.22`](3.12/Dockerfile)\n  - [`3.12-alpine3.22-slim`](3.12/Dockerfile.slim) \n- Python Runtime: 3.11\n  - [`3.11-alpine3.20`](3.11/Dockerfile)\n  - [`3.11-alpine3.20-slim`](3.11/Dockerfile.slim)\n  - [`3.11-alpine3.21`](3.11/Dockerfile)\n  - [`3.11-alpine3.21-slim`](3.11/Dockerfile.slim)\n  - [`3.11-alpine3.22`](3.11/Dockerfile)\n  - [`3.11-alpine3.22-slim`](3.11/Dockerfile.slim)\n- Python Runtime: 3.10\n  - [`3.10-alpine3.20`](3.10/Dockerfile)\n  - [`3.10-alpine3.20-slim`](3.10/Dockerfile.slim)\n  - [`3.10-alpine3.21`](3.10/Dockerfile)\n  - [`3.10-alpine3.21-slim`](3.10/Dockerfile.slim)\n  - [`3.10-alpine3.22`](3.10/Dockerfile)\n  - [`3.10-alpine3.22-slim`](3.10/Dockerfile.slim)\n\n### Variants\n\nThe base images are built on Alpine Linux and support multiple Python versions. Additionally, by default, these\nimages include third-party libraries for database connectivity.\n\nThe following libraries are included:\n\n- `PyMySQL` for MySQL\n- `psycopg2-binary` for PostgreSQL\n- `oracledb` for Oracle\n\nMoreover, there are 'slim' variants available for each Python version, which are optimized for smaller image sizes\nand do not include these third-party libraries. These slim images are suitable for applications that do not require\ndatabase connectivity.\n\n## Usage\n\nTo use these Docker images, you can build them using the provided Dockerfiles or pull them from a Docker\nregistry if available.\n\n### Building the Images\n\nTo build the images, navigate to the directory containing the Dockerfile and run:\n\n```bash\ndocker build -t \u003cimage_name\u003e:\u003ctag\u003e .\n```\n\nDocker compose can also be used to build all images at once. Ensure you have the `docker-compose.yaml` file in\nthe root directory, then run:\n\n```bash \ndocker compose --project-directory 3.13 --env-file base.env --no-cache build\n```\n\n## Generating the AWS Lambda Image\n\nTo generate an AWS Lambda image, you can create a Dockerfile in the desired directory. For example, to create an \nimage for Python 3.13 on Alpine 3.22, you can use the following `Dockerfile`:\n\n```dockerfile\nFROM python-alpine AS final-image\n\n# Set build arguments for Lambda user, group, and task root\nARG LAMBDA_USER\nARG LAMBDA_GROUP\nARG LAMBDA_TASK_ROOT\n\n# Change to a non-root user for security\nUSER ${LAMBDA_USER}\n\n# Create the Lambda task root directory\nWORKDIR ${LAMBDA_TASK_ROOT}\n\n# Copy the function code and requirements file for Python dependencies\nCOPY lambda_function.py ${LAMBDA_TASK_ROOT}\nCOPY requirements.txt ${LAMBDA_TASK_ROOT}\n\n# Install Python dependencies\nRUN pip install --target ${LAMBDA_TASK_ROOT} --requirement requirements.txt --upgrade\n\n# Set the entrypoint for the Lambda function\nENTRYPOINT [\"/var/task/lambda-entrypoint.sh\"]\n\n# Set the command to run the Lambda function handler\nCMD [\"lambda_function.lambda_handler\"]\n```\n\nFor issues with custom ca certificates, you can add the following lines to your Dockerfile prior to the final-image stage:\n\n```dockerfile\n# ------------------- Stage 1: Build Stage -------------------\nFROM ddegagne/aws-lambda:3.13-alpine3.22 AS python-alpine\n\n# Switch to root user to install certificates\nUSER root\n\n# Download CA certificate and add it to the trusted certificates\nADD https://artifactory.example.com/artifactory/dcs-container-release-local/CA-Certs/ca-certificate.crt \\\n    /usr/local/share/ca-certificates/ca-certificates.crt\n\n# Update the CA certificates\nRUN update-ca-certificates\n```\n\n### Building the Image\n\nTo build the Docker image, use the following command:\n\n```bash\ndocker build \\\n  --build-arg LAMBDA_TASK_ROOT=/var/task \\\n  --build-arg LAMBDA_USER=lambda-user \\\n  --build-arg LAMBDA_GROUP=lambda-group \\\n  -f Dockerfile \\\n  -t aws_docker_test/python3.13:local .\n```\n\n### Running the Image\n\nTo run the built Docker image, use the following command:\n\n```bash\ndocker run -p 9000:8080 aws_docker_test/python3.13:local\n```\n\n### Testing the Lambda Function\n\nYou can test the Lambda function locally using the AWS Lambda Runtime Interface Emulator. Send a POST request to the endpoint:\n\n```powershell\nInvoke-WebRequest -Uri \"http://localhost:9000/2015-03-31/functions/function/invocations\" -Method Post -ContentType \"application/json\" -Body '{}'\n```\n\nThis should return a response from your Lambda function, indicating that it is working correctly.\n\n```powershell\n# Example response\nStatusCode        : 200\nStatusDescription : OK\nContent           : {\"statusCode\": 200, \"body\": \"Hello from Lambda! nice_shtern\"}\nRawContent        : HTTP/1.1 200 OK\n                    Content-Length: 61\n                    Content-Type: text/plain; charset=utf-8\n                    Date: Thu, 21 Aug 2025 14:28:06 GMT\n\n                    {\"statusCode\": 200, \"body\": \"Hello from Lambda! nice_shtern\"}\nForms             : {}\nHeaders           : {[Content-Length, 61], [Content-Type, text/plain; charset=utf-8], [Date, Thu, 21 Aug 2025 14:28:06 GMT]}\nImages            : {}\nInputFields       : {}\nLinks             : {}\nParsedHtml        : mshtml.HTMLDocumentClass\nRawContentLength  : 61\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdegagne%2Fdocker-aws-lambda","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdegagne%2Fdocker-aws-lambda","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdegagne%2Fdocker-aws-lambda/lists"}