Skip to content

Commit

Permalink
feat: Initial automation.
Browse files Browse the repository at this point in the history
  • Loading branch information
skyzyx committed Dec 21, 2024
0 parents commit a2751db
Show file tree
Hide file tree
Showing 4 changed files with 247 additions and 0 deletions.
30 changes: 30 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Uses editorconfig to maintain consistent coding styles
# http://EditorConfig.org

root = true

[*]
charset = utf-8
end_of_line = lf
indent_size = 4
indent_style = space
insert_final_newline = true
max_line_length = 120
trim_trailing_whitespace = true

[*.toml]
indent_size = 4

[*.{css,html,js,json,less,sass,scss,yaml,yml}]
indent_size = 2

[*.{tf,tfvars}]
indent_size = 2
indent_style = space

[*.md]
max_line_length = 0
trim_trailing_whitespace = false

[Makefile*]
indent_style = tab
101 changes: 101 additions & 0 deletions .github/workflows/build-and-push.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
# https://web.archive.org/web/20240917152738/https://andrewlock.net/combining-multiple-docker-images-into-a-multi-arch-image/
name: Build and push

on:
workflow_dispatch:

# Variables available to all jobs defined in this file
env:
DOCKER_BUILDKIT: 1

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
build_intel64:
strategy:
fail-fast: true
name: Build Intel64
runs-on: [ubuntu-latest]
steps:
- name: Create Buildx driver
run: |
docker buildx use multiplatform || docker buildx create --name multiplatform --use 2>/dev/null
- name: Login to GHCR
run: |
echo "${{ secrets.GHCR_TOKEN }}" | docker login ghcr.io -u "${{ secrets.GHCR_USER }}" --password-stdin
- name: Clone AWS Lambda repo
run: |
git clone https://github.com/aws/aws-lambda-base-images.git --branch provided.al2023 --single-branch __aws__
- name: Build
run: |
set -euxo pipefail
cd __aws__/x86_64/ && \
output="$(
docker buildx build \
-t ghcr.io/northwood-labs/lambda-provided-al2023 \
-f Dockerfile.provided.al2023 \
--platform linux/amd64 \
--output push-by-digest=true,type=image,push=true \
. 2>&1
)"
echo "INTEL64_HASH=$(echo "$output" | grep "exporting manifest list" | awk '{print $5}')" >> $GITHUB_ENV
build_arm64:
strategy:
fail-fast: true
name: Build ARM64
runs-on: [ubuntu-latest]
steps:
- name: Create Buildx driver
run: |
docker buildx use multiplatform || docker buildx create --name multiplatform --use 2>/dev/null
- name: Login to GHCR
run: |
echo "${{ secrets.GHCR_TOKEN }}" | docker login ghcr.io -u "${{ secrets.GHCR_USER }}" --password-stdin
- name: Clone AWS Lambda repo
run: |
git clone https://github.com/aws/aws-lambda-base-images.git --branch provided.al2023 --single-branch __aws__
- name: Build
run: |
set -euxo pipefail
cd __aws__/arm64/ && \
output="$(
docker buildx build \
-t ghcr.io/northwood-labs/lambda-provided-al2023 \
-f Dockerfile.provided.al2023 \
--platform linux/arm64 \
--output push-by-digest=true,type=image,push=true \
. 2>&1
)"
echo "ARM64_HASH=$(echo "$output" | grep "exporting manifest list" | awk '{print $5}')" >> $GITHUB_ENV
merge:
needs: [build_intel64, build_arm64]
strategy:
fail-fast: true
name: Merge into multiplatform
runs-on: [ubuntu-latest]
steps:
- name: Create Buildx driver
run: |
docker buildx use multiplatform || docker buildx create --name multiplatform --use 2>/dev/null
- name: Login to GHCR
run: |
echo "${{ secrets.GHCR_TOKEN }}" | docker login ghcr.io -u "${{ secrets.GHCR_USER }}" --password-stdin
- name: Merge
run: |
set -euxo pipefail
docker buildx imagetools create \
-t ghcr.io/northwood-labs/lambda-provided-al2023:latest \
ghcr.io/northwood-labs/lambda-provided-al2023@${{ env.INTEL64_HASH }} \
ghcr.io/northwood-labs/lambda-provided-al2023@${{ env.ARM64_HASH }} \
;
99 changes: 99 additions & 0 deletions .markdownlint.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
{
"heading-increment": false,
"first-header-h1": true,
"header-style": {
"style": "atx"
},
"ul-style": {
"style": "asterisk"
},
"list-indent": true,
"ul-start-left": true,
"ul-indent": {
"indent": 4
},
"no-trailing-spaces": {
"br_spaces": 2,
"list_item_empty_lines": false
},
"single-trailing-newline": true,
"no-hard-tabs": {
"code_blocks": false
},
"no-reversed-links": true,
"no-multiple-blanks": {
"maximum": 1
},
"line-length": {
"line_length": 10000,
"code_blocks": false,
"tables": false
},
"commands-show-output": false,
"no-missing-space-atx": true,
"no-multiple-space-atx": true,
"blanks-around-headers": {
"lines_above": 1,
"lines_below": 1
},
"header-start-left": true,
"no-duplicate-header": {
"allow_different_nesting": true
},
"single-h1": {
"level": 1
},
"no-trailing-punctuation": {
"punctuation": ".,;:"
},
"no-multiple-space-blockquote": true,
"no-blanks-blockquote": true,
"ol-prefix": {
"style": "one"
},
"list-marker-space": {
"ul_single": 1,
"ol_single": 1,
"ul_multi": 1,
"ol_multi": 1
},
"blanks-around-fences": {
"list_items": true
},
"blanks-around-lists": true,
"no-inline-html": {
"allowed_elements": [
"a",
"b",
"br",
"code",
"details",
"div",
"img",
"li",
"nobr",
"p",
"pre",
"summary",
"ul"
]
},
"no-bare-urls": true,
"hr-style": {
"style": "consistent"
},
"no-emphasis-as-header": true,
"no-space-in-emphasis": false,
"no-space-in-code": false,
"no-space-in-links": true,
"fenced-code-language": true,
"code-block-style": {
"style": "fenced"
},
"first-line-h1": false,
"no-empty-links": true,
"proper-names": {
"names": [],
"code_blocks": false
}
}
17 changes: 17 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Multi-Platform AWS Lambda Environment Image

This repository auto-builds a multi-platform (`x86_64`/`ARM64`) Docker image for the `provided.al2023` AWS Lambda environment.

The `provided.al2023` environment is the one intended for compiled code (C, C++, Rust, Go, etc.), or to use Lambda Layers to modify.

## Source

<https://github.com/aws/aws-lambda-base-images/tree/provided.al2023>

## Usage

TBD

## Issues

If you have an issue with this multi-platform Docker image, **DO NOT FILE AN ISSUE HERE**. Instead, [file an issue with AWS](https://github.com/aws/aws-lambda-base-images/tree/provided.al2023).

0 comments on commit a2751db

Please sign in to comment.