Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 47 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
{
"name": "Pillow Lambda Layer Builder",
"image": "mcr.microsoft.com/devcontainers/base:ubuntu",

"features": {
"ghcr.io/devcontainers/features/git:1": {},
"ghcr.io/devcontainers/features/github-cli:1": {},
"ghcr.io/devcontainers/features/python:1": {
"version": "3.13"
}
},

"customizations": {
"vscode": {
"extensions": [
"ms-python.python",
"ms-python.pylint",
"ms-python.black-formatter",
"ms-toolsai.jupyter",
"redhat.vscode-yaml",
"ms-vscode.makefile-tools"
],
"settings": {
"python.defaultInterpreterPath": "/usr/local/bin/python",
"python.linting.enabled": true,
"python.linting.pylintEnabled": true,
"python.formatting.provider": "black",
"python.testing.pytestEnabled": true,
"files.exclude": {
"**/build": true,
"**/__pycache__": true,
"**/*.pyc": true
}
}
}
},

"postCreateCommand": "apt-get update && apt-get install -y python3.9 python3.9-dev python3.10 python3.10-dev python3.11 python3.11-dev python3.12 python3.12-dev && chmod +x scripts/*.sh && ./scripts/build-multi-version.sh && ./scripts/test-multi-version.sh",

"postStartCommand": "echo 'Pillow Lambda Layer Builder ready! Layer built and tested successfully.'",

"remoteUser": "root",

"runArgs": [
"--init"
]
}
45 changes: 45 additions & 0 deletions .devcontainer/setup.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
#!/bin/bash
set -e

echo "Setting up Pillow Lambda Layer Builder environment..."

# Update package lists
apt-get update

# Install software-properties-common for adding PPAs
apt-get install -y software-properties-common

# Add deadsnakes PPA for multiple Python versions
add-apt-repository ppa:deadsnakes/ppa -y

# Update package lists again
apt-get update

# Install all Python versions and their development packages
echo "Installing Python versions..."
apt-get install -y \
python3.9 python3.9-dev python3.9-distutils \
python3.10 python3.10-dev python3.10-distutils \
python3.11 python3.11-dev python3.11-distutils \
python3.12 python3.12-dev \
python3.13 python3.13-dev

# Install pip and ensure it's available for all Python versions
echo "Setting up pip for all Python versions..."
apt-get install -y python3-pip python3.9-venv python3.10-venv python3.11-venv python3.12-venv python3.13-venv
python3 -m pip install --upgrade pip

# Install pip for each Python version using get-pip.py
echo "Installing pip for each Python version..."
curl -sS https://bootstrap.pypa.io/get-pip.py -o get-pip.py
python3.9 get-pip.py --ignore-installed --break-system-packages
python3.10 get-pip.py --ignore-installed --break-system-packages
python3.11 get-pip.py --ignore-installed --break-system-packages
python3.12 get-pip.py --ignore-installed --break-system-packages
python3.13 get-pip.py --ignore-installed --break-system-packages
rm get-pip.py

# Make scripts executable
chmod +x aws-lambda-pillow-layer/scripts/*.sh

echo "Environment setup complete!"
100 changes: 100 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
name: Pillow Lambda Layer CI

on:
push:
branches: [main]
pull_request:
branches: [main]

jobs:
build-and-test:
runs-on: ubuntu-latest
name: Build and Test Python ${{ matrix.python-version }}
permissions:
contents: read
actions: write
strategy:
matrix:
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]

steps:
- name: Checkout code
uses: actions/checkout@v5

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v6
with:
python-version: ${{ matrix.python-version }}

- name: Install system dependencies
run: |
sudo apt-get update
sudo apt-get install -y \
gcc g++ make zlib1g-dev libjpeg-dev libpng-dev \
libtiff-dev libwebp-dev libfreetype6-dev liblcms2-dev \
libffi-dev libopenjp2-7-dev libharfbuzz-dev libfribidi-dev \
libxcb1-dev

- name: Build Pillow layer
run: |
chmod +x scripts/*.sh
./scripts/build.sh

- name: Test Pillow layer
run: |
./scripts/test.sh

- name: Upload layer artifact
uses: actions/upload-artifact@v4
with:
name: pillow-layer-python${{ matrix.python-version }}
path: build/pillow-layer.zip

release:
runs-on: ubuntu-latest
needs: build-and-test
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
permissions:
contents: write
actions: read
id-token: write
strategy:
matrix:
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
steps:
- name: Checkout code
uses: actions/checkout@v5

- name: Download layer artifacts
uses: actions/download-artifact@v4
with:
name: pillow-layer-python${{ matrix.python-version }}
path: layers/

- name: Create Release for Python ${{ matrix.python-version }}
uses: softprops/action-gh-release@v2
with:
tag_name: python${{ matrix.python-version }}-v${{ github.run_number }}
name: Pillow Layer Python ${{ matrix.python-version }} v${{ github.run_number }}
body: |
## Pillow Lambda Layer for Python ${{ matrix.python-version }}

This release contains a production-ready Pillow layer for AWS Lambda with Python ${{ matrix.python-version }}.

### Features
- Pillow 10.4.0
- Python ${{ matrix.python-version }} support
- x86_64 architecture
- Optimized for Lambda runtime
- Supports JPG, PNG, GIF, WEBP formats

### Usage
Upload the `pillow-layer.zip` file to AWS Lambda as a layer.

### Layer Details
- **Size**: ~3.6MB (compressed)
- **Runtime**: Python ${{ matrix.python-version }}
- **Architecture**: x86_64
files: layers/pillow-layer.zip
draft: false
prerelease: false
11 changes: 11 additions & 0 deletions .github/workflows/commitmsg-conform.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
name: Commit Message Conformance
on:
pull_request: {}
permissions:
statuses: write
checks: write
contents: read
pull-requests: read
jobs:
commitmsg-conform:
uses: actionsforge/actions/.github/workflows/commitmsg-conform.yml@main
14 changes: 14 additions & 0 deletions .github/workflows/markdown-lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: Markdown Lint

on:
pull_request: {}

permissions:
statuses: write
checks: write
contents: read
pull-requests: read

jobs:
markdown-lint:
uses: actionsforge/actions/.github/workflows/markdown-lint.yml@main
52 changes: 52 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# Python
__pycache__/
*.py[cod]
*$py.class
*.so
.Python
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
*.egg-info/
.installed.cfg
*.egg

# Virtual environments
venv/
env/
ENV/

# IDE
.vscode/
.idea/
*.swp
*.swo

# OS
.DS_Store
Thumbs.db

# AWS
.aws/

# Layer build artifacts
build/
*.zip

# Test files
test_pillow.py
test.jpg
test.png
test.webp

# Temporary files
*.tmp
*.temp
Loading