Skip to content

Docker Build & Push Nilchaind (main) #40

Docker Build & Push Nilchaind (main)

Docker Build & Push Nilchaind (main) #40

Workflow file for this run

name: Docker Build & Push Nilchaind (main)
on:
workflow_dispatch:
env:
REGISTRY: ghcr.io
IMAGE_NAME: nilchaind
jobs:
docker-build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v4
with:
images: ${{ env.REGISTRY }}/NillionNetwork/${{ env.IMAGE_NAME }}
tags: |
type=ref,event=branch
type=ref,event=tag
flavor: |
latest=false # Ensure 'latest' tag is not generated
- name: Build Docker image
uses: docker/build-push-action@v2
with:
context: .
tags: ${{ steps.meta.outputs.tags }}
build-args: BINARY_VERSION=${{ steps.meta.outputs.labels.org.opencontainers.image.version }}
- name: Debug tags
run: |
echo "Generated tags: ${{ steps.meta.outputs.tags }}"
echo "Generated labels: ${{ steps.meta.outputs.labels }}"
- name: List Docker images
run: docker images
- name: Test nilchaind is runnable
run: |
# Extract the tag from the current context
TAG=$(echo ${{ steps.meta.outputs.tags }} | cut -d ',' -f 1)
echo "Running Docker container with tag: $TAG"
docker run --rm $TAG version
- name: Log in to the Container registry
uses: docker/login-action@v2
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Push Docker image
uses: docker/build-push-action@v2
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}