42 lines
1.2 KiB
YAML
42 lines
1.2 KiB
YAML
|
|
# Save this file in your repository at: .gitea/workflows/build-docker.yml
|
|
name: Build and Push Docker Image
|
|
|
|
# This workflow runs on any push to the main branch
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
|
|
jobs:
|
|
build-and-push:
|
|
# This job will run on any runner with the 'docker' label
|
|
runs-on: docker
|
|
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Set up Docker Buildx
|
|
# This action sets up a builder instance required for build-push-action
|
|
uses: docker/setup-buildx-action@v3
|
|
|
|
- name: Log in to Docker Hub
|
|
# This action logs into your container registry
|
|
uses: docker/login-action@v3
|
|
with:
|
|
# Use secrets for your credentials
|
|
username: ${{ secrets.DOCKER_USERNAME }}
|
|
password: ${{ secrets.DOCKER_PASSWORD }}
|
|
|
|
- name: Build and push Docker image
|
|
# This action builds the Dockerfile and pushes it to the registry
|
|
uses: docker/build-push-action@v5
|
|
with:
|
|
context: .
|
|
file: ./Dockerfile # Assumes your Dockerfile is in the root of the repo
|
|
push: true
|
|
# Update with your desired image name and tag
|
|
tags: twk95/11ty-site:latest, twk95/11ty-site:${{ github.sha }}
|
|
|