85 lines
2.3 KiB
YAML
85 lines
2.3 KiB
YAML
# Gitea Actions workflow for building the Zola build container
|
|
# This workflow builds and pushes the container image to Gitea's container registry
|
|
#
|
|
# Place this file and Dockerfile in the metadata repository:
|
|
# .gitea/workflows/build-container.yaml
|
|
# Dockerfile (in repo root)
|
|
#
|
|
# Triggers:
|
|
# - When Dockerfile changes
|
|
# - Manual dispatch
|
|
#
|
|
# The built image will be available at:
|
|
# <gitea-url>/<owner>/<repo>/zola-pwsh-s3:latest
|
|
|
|
name: Build Container Image
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
paths:
|
|
- "Dockerfile"
|
|
workflow_dispatch:
|
|
|
|
env:
|
|
IMAGE_NAME: zola-pwsh-s3
|
|
# Use the host-accessible URL for registry, not the internal Docker hostname
|
|
# If your Gitea is only accessible via gitea:3000, you may need to expose it properly
|
|
REGISTRY: ${{ gitea.server_url }}
|
|
|
|
jobs:
|
|
build-container:
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- name: Debug network and DNS
|
|
run: |
|
|
echo "=== environment variables ==="
|
|
env
|
|
echo ""
|
|
echo "=== /etc/hosts contents ==="
|
|
cat /etc/hosts
|
|
echo ""
|
|
echo "=== Trying to curl gitea by hostname ==="
|
|
curl -v http://gitea:3000 || true
|
|
echo ""
|
|
echo "=== Trying to curl gitea by IP ==="
|
|
curl -v http://172.18.0.6:3000 || true
|
|
|
|
- name: Add gitea to /etc/hosts
|
|
run: echo "172.18.0.6 gitea" | sudo tee -a /etc/hosts
|
|
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Set up Docker Buildx
|
|
uses: docker/setup-buildx-action@v3
|
|
|
|
- name: Login to Gitea Container Registry
|
|
uses: docker/login-action@v3
|
|
with:
|
|
registry: ${{ env.REGISTRY }}
|
|
username: ${{ gitea.actor }}
|
|
password: ${{ secrets.GITEA_TOKEN }}
|
|
|
|
- name: Extract metadata for Docker
|
|
id: meta
|
|
uses: docker/metadata-action@v5
|
|
with:
|
|
images: ${{ env.REGISTRY }}/${{ gitea.repository }}/${{ env.IMAGE_NAME }}
|
|
tags: |
|
|
type=raw,value=latest
|
|
type=sha,prefix=
|
|
|
|
- name: Build and push container image
|
|
uses: docker/build-push-action@v5
|
|
with:
|
|
context: .
|
|
file: ./Dockerfile
|
|
push: true
|
|
tags: ${{ steps.meta.outputs.tags }}
|
|
labels: ${{ steps.meta.outputs.labels }}
|
|
cache-from: type=gha
|
|
cache-to: type=gha,mode=max
|