Skip to content

Commit 2406230

Browse files
authored
arm64 and amd64 container-based Lambda definitions (#12)
* arm64 build * add some missing bits * update gha * matrix * needs * typo * matrix syntax * back up awslambdaric * need qemu setup * only push containers for PR merges
1 parent 7251166 commit 2406230

File tree

15 files changed

+362
-527
lines changed

15 files changed

+362
-527
lines changed

.github/workflows/build.yml

Lines changed: 64 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,52 +1,78 @@
11
name: Build
22

3-
on:
4-
pull_request:
5-
branches:
6-
- '*'
7-
push:
8-
branches:
9-
- '*'
10-
release:
11-
types:
12-
- published
3+
on: [push, pull_request, workflow_dispatch]
4+
135
jobs:
14-
docker:
15-
name: Docker
166

7+
config:
178
runs-on: ubuntu-latest
18-
strategy:
19-
fail-fast: true
20-
timeout-minutes: 240
21-
9+
outputs:
10+
matrix: ${{ steps.set-matrix.outputs.matrix }}
2211
steps:
23-
- uses: actions/checkout@v2
24-
- name: Build and push Docker images
25-
uses: docker/build-push-action@v1
26-
with:
27-
username: ${{ secrets.DOCKER_USERNAME }}
28-
password: ${{ secrets.DOCKER_PASSWORD }}
29-
repository: pdal/lambda
30-
tag_with_ref: true
31-
tag_with_sha: true
32-
push: ${{ startsWith(github.ref, 'refs/tags/') }}
33-
34-
# if: ${{ startsWith(github.ref, 'refs/tags/') }}
35-
12+
- id: set-matrix
13+
run: echo "::set-output name=matrix::{\"include\":[{\"type\":\"amd64\",\"image\":\"amazon/aws-lambda-provided:al2\", \"arch\":\"x86_64\"},{\"type\":\"arm64\",\"image\":\"amazon/aws-lambda-provided:al2.2022.03.02.08\", \"arch\":\"arm64\"}] }"
3614

37-
layer:
38-
name: Layer
39-
needs: [docker]
40-
container: pdal/lambda
4115

16+
containers:
17+
needs: config
4218
runs-on: ubuntu-latest
4319
strategy:
4420
fail-fast: true
45-
timeout-minutes: 60
46-
21+
matrix: ${{fromJson(needs.config.outputs.matrix)}}
22+
env:
23+
PUSH_PACKAGES: ${{ github.repository_owner == 'PDAL' && github.event_name != 'pull_request'}}
4724
steps:
4825
- uses: actions/checkout@v2
49-
- name: Package
50-
shell: bash -l {0}
26+
- name: Set up QEMU
27+
uses: docker/setup-qemu-action@v2
28+
29+
- name: Lint
30+
id: lint
5131
run: |
52-
/package-pdal.sh
32+
echo "are we pushing packages" ${{ env.PUSH_PACKAGES }}
33+
echo "event_name" ${{ github.event_name }}
34+
echo "ref" ${{ github.ref }}
35+
- name: Setup Docker Buildx
36+
id: buildx
37+
uses: docker/setup-buildx-action@v1
38+
with:
39+
version: latest
40+
- if: ${{ env.PUSH_PACKAGES == 'true' }}
41+
name: Login to GitHub Container Registry
42+
uses: docker/login-action@v1
43+
with:
44+
registry: ghcr.io
45+
username: ${{ github.repository_owner }}
46+
password: ${{ secrets.GHCR_TOKEN }}
47+
- name: Prepare
48+
id: prep
49+
run: |
50+
VERSION=sha-${GITHUB_SHA::8}
51+
if [[ $GITHUB_REF == refs/tags/* ]]; then
52+
VERSION=${GITHUB_REF/refs\/tags\//}
53+
fi
54+
echo ::set-output name=BUILD_DATE::$(date -u +'%Y-%m-%dT%H:%M:%SZ')
55+
echo ::set-output name=VERSION::${VERSION}
56+
- name: Build image
57+
uses: docker/build-push-action@v2
58+
with:
59+
push: ${{ env.PUSH_PACKAGES == 'true' }}
60+
builder: ${{ steps.buildx.outputs.name }}
61+
context: .
62+
file: ./Dockerfile
63+
platforms: linux/${{ matrix.type}}
64+
build-args: |
65+
LAMBDA_IMAGE=${{ matrix.image }}
66+
RIE_ARCH=${{ matrix.arch }}
67+
tags: |
68+
ghcr.io/pdal/lambda:${{ steps.prep.outputs.VERSION }}
69+
ghcr.io/pdal/lambda:latest
70+
labels: |
71+
org.opencontainers.image.title=${{ github.event.repository.name }}
72+
org.opencontainers.image.description=${{ github.event.repository.description }}
73+
org.opencontainers.image.source=${{ github.event.repository.html_url }}
74+
org.opencontainers.image.url=${{ github.event.repository.html_url }}
75+
org.opencontainers.image.revision=${{ github.sha }}
76+
org.opencontainers.image.version=${{ steps.prep.outputs.VERSION }}
77+
org.opencontainers.image.created=${{ steps.prep.outputs.BUILD_DATE }}
78+

0 commit comments

Comments
 (0)