diff --git a/.github/workflows/docker-image.yaml b/.github/workflows/docker-image.yaml new file mode 100644 index 0000000..8cd7055 --- /dev/null +++ b/.github/workflows/docker-image.yaml @@ -0,0 +1,57 @@ +name: Build and Push Backstage Image + +on: + workflow_dispatch: + inputs: + branch: + description: "branch to build" + required: true + default: backstage-image + push: + branches: + - backstage-image + + + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v2 + with: + ref: cnoe + + - name: Install packages + run: NODE_OPTIONS="--max_old_space_size=4096" yarn install + + - name: Sanity check + run: NODE_OPTIONS="--max_old_space_size=4096" yarn tsc + + - name: Bundle up + run: NODE_OPTIONS="--max_old_space_size=4096" yarn build:all + + - name: Configure AWS credentials + uses: aws-actions/configure-aws-credentials@v2 + with: + aws-access-key-id: ${{ secrets.ACCESS_KEY }} + aws-secret-access-key: ${{ secrets.SECRET_KEY }} + aws-region: us-east-1 + + - name: Login to Amazon ECR + id: login-ecr + uses: aws-actions/amazon-ecr-login@v1 + + - name: Build, tag, and push the image to Amazon ECR + id: build-image + env: + ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }} + ECR_REPOSITORY: ${{ secrets.REPO_NAME }} + IMAGE_TAG: ${{ github.sha }} + run: | + # Build a docker container and push it to ECR + docker build -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG . + echo "Pushing image to ECR..." + docker push $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG + echo "name=image::$ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG" >> $GITHUB_OUTPUT