ToolJet/.github/workflows/manual-docker-build.yml
2025-12-01 13:34:35 +05:30

78 lines
2.3 KiB
YAML

name: Manual Docker Build and Push
on:
workflow_dispatch:
inputs:
branch_name:
description: "Git branch to build from"
required: true
default: "main"
dockerfile_path:
description: "Path to Dockerfile"
required: true
type: choice
options:
- ./docker/LTS/ee/ee-production.Dockerfile
- ./docker/pre-release/ee/ee-production.Dockerfile
- ./docker/LTS/cloud/cloud-server.Dockerfile
docker_tag:
description: "Docker tag suffix (e.g., pre-release-14)"
required: true
jobs:
build-and-push:
runs-on: ubuntu-latest
steps:
- name: Free up disk space
run: |
sudo rm -rf /usr/share/dotnet
sudo rm -rf /opt/ghc
sudo rm -rf /usr/local/share/boost
sudo rm -rf "$AGENT_TOOLSDIRECTORY"
sudo docker system prune -af
sudo apt-get clean
df -h
- name: Checkout repo
uses: actions/checkout@v4
with:
ref: ${{ github.event.inputs.branch_name }}
fetch-depth: 0
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to DockerHub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PAT }}
- name: Generate full Docker tag
id: taggen
run: |
input_tag="${{ github.event.inputs.docker_tag }}"
if [[ "$input_tag" == *"/"* ]]; then
echo "tag=$input_tag" >> $GITHUB_OUTPUT
else
echo "tag=tooljet/tj-osv:$input_tag" >> $GITHUB_OUTPUT
fi
- name: Build and Push Docker image
uses: docker/build-push-action@v4
with:
context: .
file: ${{ github.event.inputs.dockerfile_path }}
push: true
tags: ${{ steps.taggen.outputs.tag }}
platforms: linux/amd64
cache-from: type=gha
cache-to: type=gha,mode=max
build-args: |
CUSTOM_GITHUB_TOKEN=${{ secrets.CUSTOM_GITHUB_TOKEN }}
BRANCH_NAME=${{ github.event.inputs.branch_name }}
- name: Show the full Docker tag
run: |
echo "✅ Docker image will be tagged as: ${{ steps.taggen.outputs.tag }}"