name: Build Language Docker Image (Reusable)
on:
workflow_call:
inputs:
language:
description: Language name (python, javascript, java)
type: string
required: true
dockerfile:
description: Path to Dockerfile
type: string
required: true
python-version:
description: Python version (required for setup-aidb-env)
type: string
required: true
env:
DOCKER_BUILDKIT: 1
jobs:
build-language-image:
name: Build ${{ inputs.language }} Image
runs-on: ubuntu-latest
timeout-minutes: 8
steps:
- name: Checkout code
uses: actions/checkout@v6
- name: Setup AIDB environment
uses: ./.github/actions/setup-aidb-env
with:
python-version: ${{ inputs.python-version }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Load version build args
run: |
source venv/bin/activate
./dev-cli versions docker --format env | sed 's/^export //' >> $GITHUB_ENV
- name: Build and push ${{ inputs.language }} image
uses: ./.github/actions/retry-command
with:
command: |
docker buildx build \
--push \
--file ${{ inputs.dockerfile }} \
--tag ghcr.io/${{ github.repository }}/test-${{ inputs.language }}:latest \
--tag ghcr.io/${{ github.repository }}/test-${{ inputs.language }}:${{ github.sha }} \
--cache-from type=gha,scope=${{ inputs.language }} \
--cache-to type=gha,scope=${{ inputs.language }},mode=max \
--build-arg AIDB_TEST_BASE_IMAGE=ghcr.io/${{ github.repository }}/test-base:buildcache \
--build-arg NODE_VERSION=${{ env.NODE_VERSION }} \
--build-arg TYPESCRIPT_VERSION=${{ env.TYPESCRIPT_VERSION }} \
--build-arg TS_NODE_VERSION=${{ env.TS_NODE_VERSION }} \
--build-arg JDTLS_VERSION=${{ env.JDTLS_VERSION }} \
.