Skip to content

Instantly share code, notes, and snippets.

@goforbg
Created March 6, 2022 17:16
Show Gist options
  • Save goforbg/26dd14e1e42b7619277f97ae6425afb1 to your computer and use it in GitHub Desktop.
Save goforbg/26dd14e1e42b7619277f97ae6425afb1 to your computer and use it in GitHub Desktop.
---
name: Build and Push Docker Image to AWS ECR
on:
push:
branches: [ master ]
env:
A_ACCESS: '${{ secrets.A_ACCESS }}'
A_SECRET: '${{ secrets.A_SECRET }}'
FOO: '${{ secrets.FOO }}'
jobs:
build-and-push:
name: Build Project and Push to AWS ECR
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.A_ACCESS }}
aws-secret-access-key: ${{ secrets.A_SECRET }}
aws-region: eu-west-1
- name: Login to Amazon ECR
id: login-ecr
uses: aws-actions/amazon-ecr-login@v1
- name: Build and Push to AWS ECR
id: build-image
env:
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }}
run: |
docker build --build-arg FOO=$FOO -t $ECR_REGISTRY/crew-charge-app:latest .
docker push $ECR_REGISTRY/crew-charge-app:latest
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment