Skip to content

Using a var for the role #25

Using a var for the role

Using a var for the role #25

Workflow file for this run

name: Build and upload docker image
on:
push:
branches:
- '**'
permissions:
id-token: write # for JWT request
contents: read # for actions/checkout
jobs:
docker-image-build:
name: docker-image-build
runs-on: ubuntu-latest
steps:
- name: Setup tmate session
uses: mxschmitt/action-tmate@v3
if: ${{ github.event_name == 'workflow_dispatch' && inputs.debug_enabled }}
with:
limit-access-to-actor: true
- name: Checkout repo
uses: actions/[email protected]
- name: Configure AWS Credentials
uses: aws-actions/[email protected]
with:
role-to-assume: ${{ vars.AWS_ROLE_TO_ASSUME }}
aws-region: eu-west-2
role-session-name: github-aws-access
- name: Login to Amazon ECR
id: login-ecr
uses: aws-actions/[email protected]
- name: Build, tag, and push docker image to Amazon ECR
env:
REGISTRY: ${{ steps.login-ecr.outputs.registry }}
REPOSITORY: "fb-editor"
IMAGE_TAG: ${{ github.sha }}
REPO_TAG: "fb-editor:${{ github.sha }}"
run: |
docker build -f docker/web/Dockerfile -t ${{ env.REPO_TAG }} .
docker tag ${{ env.REPO_TAG }} ${{ env.REGISTRY }}/${{ env.REPO_TAG}}
docker push ${{ env.REGISTRY }}/${{ env.REPOSITORY }}:${{ env.IMAGE_TAG }}