Skip to content

Build and Publish Docker Image #1

Build and Publish Docker Image

Build and Publish Docker Image #1

Workflow file for this run

name: Build and Publish Docker Image
on:
workflow_dispatch:
inputs:
release_tag:
description: 'Release Tag (leave empty for auto-generated timestamp)'
required: false
default: ''
debug_logging:
description: 'Enable debug logging in the image'
type: boolean
required: false
default: false
jobs:
build-and-publish:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Get timestamp
id: timestamp
run: echo "timestamp=$(date +'%Y%m%d-%H%M%S')" >> $GITHUB_OUTPUT
- name: Determine tag
id: tag
run: |
if [ -z "${{ github.event.inputs.release_tag }}" ]; then
echo "tag=${{ steps.timestamp.outputs.timestamp }}" >> $GITHUB_OUTPUT
else
echo "tag=${{ github.event.inputs.release_tag }}" >> $GITHUB_OUTPUT
fi
- name: Build and push
uses: docker/build-push-action@v4
with:
context: .
push: true
tags: |
tensorblockai/forge:latest
tensorblockai/forge:${{ steps.tag.outputs.tag }}
cache-from: type=gha
cache-to: type=gha,mode=max