Skip to content
Closed
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
13 changes: 13 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
version: 2
updates:
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"
groups:
github-actions:
patterns:
- "*"
commit-message:
prefix: "ci"
open-pull-requests-limit: 5
59 changes: 59 additions & 0 deletions .github/workflows/push-to-ecr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
name: Build and Push to ECR

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

# Required for requesting the OIDC JWT token
permissions:
id-token: write
contents: read

env:
ECR_REPOSITORY: aws-lambda-nodejs-runtime

jobs:
build-and-push:
strategy:
fail-fast: false
matrix:
include:
- arch: amd64
runner-label: codebuild-project-aws-aws-lambda-nodejs-runtime-x86-${{ github.run_id }}-${{ github.run_attempt }}
- arch: arm64
runner-label: codebuild-project-aws-aws-lambda-nodejs-runtime-arm64-${{ github.run_id }}-${{ github.run_attempt }}
runs-on: ${{ matrix.runner-label }}
environment: ${{ github.event_name == 'push' && 'deploy' || '' }}
steps:
- name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1

- name: Build image
env:
ARCH: ${{ matrix.arch }}
run: docker build --build-arg "ARCH=$ARCH" -t "$ECR_REPOSITORY:$ARCH" .

- name: Configure AWS credentials (OIDC)
if: github.event_name == 'push'
uses: aws-actions/configure-aws-credentials@e1253824e5c10ff9df46874f81ed3ec929e19cfd # v6.3.0
with:
role-to-assume: ${{ secrets.AWS_ROLE_ARN }}
aws-region: ${{ secrets.AWS_REGION }}

- name: Login to Amazon ECR
if: github.event_name == 'push'
id: login-ecr
uses: aws-actions/amazon-ecr-login@03f1aad4c6c7ffd436567f42f9384779290529bd # v2.1.7

- name: Push image
if: github.event_name == 'push'
env:
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }}
ARCH: ${{ matrix.arch }}
run: |
IMAGE="$ECR_REGISTRY/$ECR_REPOSITORY:${{ github.sha }}-$ARCH"
docker tag "$ECR_REPOSITORY:$ARCH" "$IMAGE"
docker push "$IMAGE"
4 changes: 4 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
FROM scratch
ARG ARCH=unknown
LABEL dev.maxday.image.architecture=$ARCH
COPY hello.txt /hello.txt
1 change: 1 addition & 0 deletions hello.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
hello from maxday