Updates.
This commit is contained in:
@@ -0,0 +1,61 @@
|
||||
name: Build and Push PHP Container Image
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [main] # or master / your default branch
|
||||
# Optional: also on tags
|
||||
# tags: ['v*']
|
||||
|
||||
jobs:
|
||||
build-and-push:
|
||||
runs-on: ubuntu-latest
|
||||
# Recommended for Docker build tools on many self-hosted runners
|
||||
container:
|
||||
image: catthehacker/ubuntu:act-latest
|
||||
env:
|
||||
REGISTRY: gitea.example.com # ← your Gitea hostname (no https://)
|
||||
IMAGE_NAME: ${{ gitea.repository }} # owner/repo style, or hard-code owner/image
|
||||
# Or: IMAGE_NAME: myuser/php-website
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Set up QEMU (for multi-arch, optional)
|
||||
uses: docker/setup-qemu-action@v3
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
# Only needed if your Gitea registry is HTTP / self-signed:
|
||||
# with:
|
||||
# config-inline: |
|
||||
# [registry."gitea.example.com"]
|
||||
# http = true
|
||||
# insecure = true
|
||||
|
||||
- name: Login to Gitea Container Registry
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
registry: ${{ env.REGISTRY }}
|
||||
username: ${{ secrets.REGISTRY_USERNAME }}
|
||||
password: ${{ secrets.REGISTRY_PASSWORD }}
|
||||
|
||||
- name: Extract metadata / tags
|
||||
id: meta
|
||||
run: |
|
||||
echo "VERSION=$(git describe --tags --always 2>/dev/null || echo ${{ gitea.sha }})" >> $GITHUB_OUTPUT
|
||||
# or simply use latest + sha
|
||||
|
||||
- name: Build and push
|
||||
uses: docker/build-push-action@v6
|
||||
with:
|
||||
context: .
|
||||
file: ./Dockerfile
|
||||
push: true
|
||||
tags: |
|
||||
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest
|
||||
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ gitea.sha }}
|
||||
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.meta.outputs.VERSION }}
|
||||
# platforms: linux/amd64,linux/arm64 # uncomment for multi-arch
|
||||
# cache-from: type=registry,ref=...
|
||||
# cache-to: type=registry,ref=...,mode=max
|
||||
Reference in New Issue
Block a user