mirror of
https://github.com/alexgo-io/redstone-cache-layer.git
synced 2026-01-12 08:34:36 +08:00
44 lines
1.3 KiB
YAML
44 lines
1.3 KiB
YAML
name: Deploy lambda docker image to AWS ECR Public
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
|
|
jobs:
|
|
build:
|
|
name: Build Image
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- name: Check out code
|
|
uses: actions/checkout@v2
|
|
|
|
- name: Configure AWS credentials
|
|
uses: aws-actions/configure-aws-credentials@v1
|
|
with:
|
|
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
|
|
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
|
|
aws-region: eu-west-1
|
|
|
|
- name: Login to Amazon ECR
|
|
id: login-ecr
|
|
uses: aws-actions/amazon-ecr-login@v1
|
|
|
|
- name: Get short SHA
|
|
id: sha
|
|
run: echo "::set-output name=sha7::$(echo ${GITHUB_SHA} | cut -c1-7)"
|
|
|
|
- name: Get repo name
|
|
id: repo-name
|
|
run: echo "::set-output name=reponame::$(echo ${{github.repository}} | cut -d '/' -f 2)"
|
|
|
|
- name: Build, tag, and push image to Amazon ECR
|
|
env:
|
|
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }}
|
|
ECR_REPOSITORY: ${{ steps.repo-name.outputs.reponame }}-lambda
|
|
IMAGE_TAG: ${{ steps.sha.outputs.sha7 }}
|
|
run: |
|
|
docker build -f Dockerfile.lambda -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG .
|
|
docker push $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG
|