Skip to content
name: Build and Push Docker Image
on:
push:
branches:
- main
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Log in to GitHub Docker Registry
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin
- name: Build and Push
uses: docker/build-push-action@v6
with:
context: .
push: true
file: Dockerfile
tags: ghcr.io/${{ github.repository }}/terraspace-tofu:latest
- name: Build and Push Docker Image
run: |
docker build -t ghcr.io/${{ github.repository }}/terraspace-tofu:latest -f Dockerfile .
docker push ghcr.io/${{ github.repository }}/terraspace-tofu:latest
- name: Verify Docker Image
run: docker run ghcr.io/${{ github.repository }}/terraspace-tofu:latest terraspace version