44 lines
1.7 KiB
YAML
44 lines
1.7 KiB
YAML
name: Docker Build and Push Demo
|
|
run-name: ${{ gitea.actor }} is building a Docker image 🐳
|
|
on: [push]
|
|
|
|
jobs:
|
|
Build-Docker-Image:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- run: echo "🎉 The job was automatically triggered by a ${{ gitea.event_name }} event."
|
|
- run: echo "🐧 This job is now running on a ${{ runner.os }} server hosted by Gitea!"
|
|
- run: echo "🔎 The name of your branch is ${{ gitea.ref }} and your repository is ${{ gitea.repository }}."
|
|
|
|
- name: Check out repository code
|
|
uses: actions/checkout@v4
|
|
|
|
- run: echo "💡 The ${{ gitea.repository }} repository has been cloned to the runner."
|
|
|
|
- name: List files in the repository
|
|
run: |
|
|
echo "📁 Repository contents:"
|
|
ls -la ${{ gitea.workspace }}
|
|
|
|
- name: Set up Docker Buildx
|
|
uses: docker/setup-buildx-action@v3
|
|
|
|
- name: Login to Gitea Container Registry
|
|
uses: docker/login-action@v3
|
|
with:
|
|
registry: ${{ gitea.server_url }}
|
|
username: ${{ gitea.actor }}
|
|
password: ${{ secrets.GITEATOKEN }}
|
|
|
|
- run: echo "🔨 Building Docker image..."
|
|
|
|
- name: Build and push Docker image
|
|
uses: docker/build-push-action@v5
|
|
with:
|
|
context: .
|
|
push: true
|
|
tags: git.eurekin.pl/${{ gitea.repository_owner }}/hello-gitea:latest,git.eurekin.pl/${{ gitea.repository_owner }}/hello-gitea:${{ gitea.sha }}
|
|
|
|
- run: echo "📦 Docker image has been pushed to the registry!"
|
|
- run: echo "🎯 You can pull it with docker pull git.eurekin.pl/${{ gitea.repository_owner }}/hello-gitea:latest"
|
|
- run: echo "🍏 This job's status is ${{ job.status }}." |