Skip to content

Automatic docker build #1

Automatic docker build

Automatic docker build #1

name: Docker Build (Dev)
on:
pull_request:
types:
- closed
branches:
- dev
jobs:
build:

Check failure on line 11 in .github/workflows/docker-build-dev.yml

View workflow run for this annotation

GitHub Actions / Docker Build (Dev)

Invalid workflow file

The workflow is not valid. .github/workflows/docker-build-dev.yml (Line: 11, Col: 3): The workflow must contain at least one job with no dependencies.
if: github.event.pull_request.merged == true # Only run if the PR was merged
runs-on: ubuntu-latest
needs: lint # Reference the lint job from eslint.yml
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- 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: ${{ vars.AWS_REGION }}
- name: Log in to AWS ECR
id: login-ecr
uses: aws-actions/amazon-ecr-login@v2
- name: Extract repository name and short commit ID
id: extract_repo
run: |
REPO_NAME=$(echo "${{ github.repository }}" | awk -F '/' '{print $2}' | tr '[:upper:]' '[:lower:]')
SHORT_COMMIT_ID=$(echo "${{ github.sha }}" | cut -c1-7)
echo "repo_name=${REPO_NAME}" >> $GITHUB_OUTPUT
echo "short_commit_id=${SHORT_COMMIT_ID}" >> $GITHUB_OUTPUT
- name: Build and push Docker image
uses: docker/build-push-action@v6
with:
context: .
push: true
tags: |
${{ steps.login-ecr.outputs.registry }}/${{ steps.extract_repo.outputs.repo_name }}:dev-${{ steps.extract_repo.outputs.short_commit_id }}
${{ steps.login-ecr.outputs.registry }}/${{ steps.extract_repo.outputs.repo_name }}:dev-latest