Skip to content

backend/enh/docker-push-for-ci #19

backend/enh/docker-push-for-ci

backend/enh/docker-push-for-ci #19

Workflow file for this run

jobs:
build:
runs-on: x86_64-linux
steps:
- uses: actions/checkout@v4
- name: Install Nix
uses: cachix/install-nix-action@v25
with:
nix_path: nixpkgs=channel:nixos-unstable
- name: Build and push Docker image
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
# Build and load Docker image
docker load -i $(nix build .#dockerImage --no-link --print-out-paths)
# Set image name and tag
IMAGE_NAME="ghcr.io/nammayatri/beckn-gateway"
IMAGE_TAG="${GITHUB_SHA::7}"
FULL_IMAGE_NAME="${IMAGE_NAME}:${IMAGE_TAG}"
# Login to GitHub Container Registry
echo "$GITHUB_TOKEN" | docker login ghcr.io -u "${{ github.actor }}" --password-stdin
# Tag and push the image
docker tag "ghcr.io/nammayatri/beckn-gateway:a7c614" "$FULL_IMAGE_NAME"
docker push "$FULL_IMAGE_NAME"
# Logout
docker logout ghcr.io
echo "Pushed image: $FULL_IMAGE_NAME"