Skip to content

Update build-docker-image.yaml #2

Update build-docker-image.yaml

Update build-docker-image.yaml #2

name: Appsmith Build Docker Image Workflow
on:
push:
branches:
- release
- master
jobs:
build-docker:
runs-on: ubuntu-latest
if: |
github.event.pull_request.head.repo.full_name == github.repository ||
github.event_name == 'push' ||
github.event_name == 'workflow_dispatch' ||
github.event_name == 'repository_dispatch' ||
github.event_name == 'schedule'
defaults:
run:
shell: bash
steps:
# Check out merge commit
- name: Fork based /ok-to-test checkout
if: inputs.pr != 0
uses: actions/checkout@v4
with:
ref: "refs/pull/${{ inputs.pr }}/merge"
# Checkout the code in the current branch in case the workflow is called because of a branch push event
- name: Checkout the head commit of the branch
if: inputs.pr == 0
uses: actions/checkout@v4
- name: Download the client build artifact
if: steps.run_result.outputs.run_result != 'success'
uses: actions/download-artifact@v4
with:
name: client-build
path: app/client
- name: Unpack the client build artifact
if: steps.run_result.outputs.run_result != 'success'
run: |
mkdir -p app/client/build
tar -xvf app/client/build.tar -C app/client/build
- name: Download the server build artifact
if: steps.run_result.outputs.run_result != 'success'
uses: actions/download-artifact@v4
with:
name: server-build
path: app/server/dist/
- name: Download the rts build artifact
if: steps.run_result.outputs.run_result != 'success'
uses: actions/download-artifact@v4
with:
name: rts-dist
path: app/client/packages/rts/dist
- name: Un-tar the rts folder
run: |
tar -xvf app/client/packages/rts/dist/rts-dist.tar -C app/client/packages/rts/
echo "Cleaning up the tar files"
rm app/client/packages/rts/dist/rts-dist.tar
- name: Generate info.json
run: |
if [[ -f scripts/generate_info_json.sh ]]; then
scripts/generate_info_json.sh
fi
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
timeout-minutes: 5
- name: Create Tag
id: tag
run: echo "tag=${{ github.ref_name }}-$(git rev-parse --short HEAD)-$(date +%s)" >> $GITHUB_OUTPUT
timeout-minutes: 5
# - name: Login to ECR
# uses: docker/login-action@v3
# with:
# registry: ${{ secrets.AWS_ECR_REGISTRY }}
# username: ${{ secrets.AWS_ECR_ACCESS_KEY_ID}}
# password: ${{ secrets.AWS_ECR_SECRET_ACCESS_KEY }}
# timeout-minutes: 5
- name: Build and Push Docker Image
uses: docker/build-push-action@v5
with:
context: ./app
push: false
tags: ${{ secrets.AWS_ECR_REGISTRY }}/${{ vars.AWS_ECR_REPOSITORY_APP }}:${{ steps.tag.outputs.tag }}
timeout-minutes: 5