Skip to content

Commit a92c71b

Browse files
committed
Updates
1 parent 9878e77 commit a92c71b

4 files changed

Lines changed: 34 additions & 32 deletions

File tree

.github/workflows/build-runtime.yml

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ permissions:
1414

1515
env:
1616
PYTHON_VERSION: '3.12'
17+
RUNTIME_NAME: 'cubed-runtime'
1718

1819
jobs:
1920
build:
@@ -46,19 +47,13 @@ jobs:
4647
- name: Install Lithops
4748
run: pip install 'lithops[aws]'
4849

49-
- name: Set runtime name
50-
id: runtime
51-
run: |
52-
name=$(echo '${{ github.event.repository.name }}' | tr '[:upper:]' '[:lower:]' | sed 's/[^a-z0-9-]/-/g')
53-
echo "name=$name" >> $GITHUB_OUTPUT
54-
5550
- name: Copy Lithops config
5651
run: |
5752
mkdir -p ~/.lithops
5853
cp .lithops/config ~/.lithops/config
5954
6055
- name: Build runtime
61-
run: lithops runtime build ${{ steps.runtime.outputs.name }} -b aws_lambda
56+
run: lithops runtime build ${{ env.RUNTIME_NAME }} -b aws_lambda
6257

6358
- name: Deploy runtime
64-
run: lithops runtime deploy ${{ steps.runtime.outputs.name }} -b aws_lambda
59+
run: lithops runtime deploy ${{ env.RUNTIME_NAME }} -b aws_lambda

.lithops/config

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,5 @@ region = us-east-1
77

88
[aws_lambda]
99
execution_role = arn:aws:iam::ACCOUNT_ID:role/ROLE_NAME
10-
runtime_memory = 512
11-
runtime_timeout = 300
10+
runtime_memory = 2000
11+
runtime_timeout = 180

README.md

Lines changed: 26 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
1-
# Lithops Runtime Builder
1+
# Cubed Lithops Runtime Builder
22

3-
A GitHub template repository for building and deploying custom [Lithops](https://lithops-cloud.github.io/) Lambda runtimes via CI — no local Docker required.
3+
A GitHub template repository for building and deploying [Lithops](https://lithops-cloud.github.io/) Lambda runtimes for [Cubed](https://github.com/cubed-dev/cubed) via CI — no local Docker required.
44

5-
When you push changes to `requirements.txt`, GitHub Actions builds a Docker image with your dependencies and deploys it as a Lambda container runtime.
5+
When you push changes to `requirements.txt`, GitHub Actions builds a Docker image with your dependencies and deploys it as a Lambda container runtime named `cubed-runtime`.
66

77
## Prerequisites
88

99
- An AWS account
1010
- A GitHub account
11+
- The [AWS CLI](https://docs.aws.amazon.com/cli/latest/userguide/getting-started-install.html)
1112

1213
## Setup
1314

@@ -17,47 +18,51 @@ Click **Use this template** → **Create a new repository**.
1718

1819
### 2. Bootstrap AWS
1920

20-
You need an IAM role that GitHub Actions can assume via OIDC. Create the GitHub OIDC identity provider in your AWS account (if not already present), then create a role with a trust policy scoped to your repo:
21-
22-
```json
23-
{
24-
"Effect": "Allow",
25-
"Principal": { "Federated": "arn:aws:iam::ACCOUNT_ID:oidc-provider/token.actions.githubusercontent.com" },
26-
"Action": "sts:AssumeRoleWithWebIdentity",
27-
"Condition": {
28-
"StringLike": { "token.actions.githubusercontent.com:sub": "repo:YOUR_ORG/YOUR_REPO:*" }
29-
}
30-
}
21+
Run this once from your local machine. Replace `YOUR_ORG` with your GitHub username or organisation (e.g. `octocat`) and `YOUR_REPO` with the name you gave this repository.
22+
23+
```bash
24+
aws cloudformation deploy \
25+
--template-file cloudformation/github-oidc-role.yml \
26+
--stack-name cubed-lithops-github-actions \
27+
--parameter-overrides GitHubOrg=YOUR_ORG GitHubRepo=YOUR_REPO \
28+
--capabilities CAPABILITY_NAMED_IAM
3129
```
3230

33-
The role needs permissions for ECR, Lambda, S3, and (optionally) CodeBuild.
31+
> **Already have a GitHub OIDC provider?** Use `--parameter-overrides GitHubOrg=YOUR_ORG GitHubRepo=YOUR_REPO CreateOIDCProvider=false` to skip creating one.
32+
33+
This creates a GitHub OIDC identity provider (if one doesn't already exist) and an IAM role scoped to your repository. When it completes, retrieve the role ARN:
34+
35+
```bash
36+
aws cloudformation describe-stacks \
37+
--stack-name cubed-lithops-github-actions \
38+
--query 'Stacks[0].Outputs[0].OutputValue' \
39+
--output text
40+
```
3441

3542
### 3. Add the secret
3643

3744
In your repo: **Settings → Secrets and variables → Actions → New repository secret**
3845

3946
| Name | Value |
4047
|------|-------|
41-
| `AWS_ROLE_ARN` | `arn:aws:iam::ACCOUNT_ID:role/ROLE_NAME` |
48+
| `AWS_ROLE_ARN` | *(ARN from the previous step)* |
4249

4350
### 4. Edit `.lithops/config`
4451

4552
Replace the placeholder values:
4653

4754
```ini
4855
[aws]
49-
region = us-east-1 # your AWS region
56+
region = us-east-1 # your AWS region
5057

5158
[aws_lambda]
5259
execution_role = arn:aws:iam::ACCOUNT_ID:role/ROLE_NAME # Lambda execution role
5360
```
5461

5562
### 5. Add your dependencies
5663

57-
Edit `requirements.txt` and push — the CI pipeline builds and deploys your runtime automatically.
58-
59-
The runtime is named after your repository (lowercased).
64+
Edit `requirements.txt` and push — the CI pipeline builds and deploys the runtime automatically.
6065

6166
## Manual trigger
6267

63-
You can also trigger a build manually from **Actions → Build and Deploy Lithops Runtime → Run workflow**.
68+
You can also trigger a build from **Actions → Build and Deploy Lithops Runtime → Run workflow**.

requirements.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
1-
numpy
1+
cubed
2+
s3fs
3+
# Add extra dependencies below

0 commit comments

Comments
 (0)