Skip to content

Build, Push, & Deploy #12417

Build, Push, & Deploy

Build, Push, & Deploy #12417

Workflow file for this run

name: Build & Push to ECR
on:
workflow_dispatch:
workflow_run:
workflows: ["Code Checks"]
branches: [master]
types: [completed]
permissions:
contents: read
jobs:
build_and_push:
name: Build and Push
env:
BUNDLE_ENTERPRISE__CONTRIBSYS__COM: ${{ secrets.BUNDLE_ENTERPRISE__CONTRIBSYS__COM }}
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v4
- name: Setup Environment
run: echo "VETS_API_USER_ID=$(id -u)" >> $GITHUB_ENV
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v4
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: us-gov-west-1
- name: Login to ECR
id: login-ecr
uses: aws-actions/amazon-ecr-login@v2
- name: Build Docker Image
uses: docker/build-push-action@v5
with:
build-args: |
sidekiq_license=${{ env.BUNDLE_ENTERPRISE__CONTRIBSYS__COM }}
userid=${{ env.VETS_API_USER_ID }}
RAILS_ENV=production
context: .
target: production
push: true
tags: |
${{ steps.login-ecr.outputs.registry }}/${{ secrets.ECR_REPOSITORY }}:${{ github.sha }}
cache-from: type=registry,ref=$ECR_REGISTRY/$ECR_REPOSITORY
cache-to: type=inline