2.2 KiB
2.2 KiB
tags
| tags | |||
|---|---|---|---|
|
Building images and storing them inside Gitea's built-in registry (://example.com) ensures that you can decouple your actual build step from the live deployment server. It also provides a snapshot history of your homelab services.
- Update your
docker-compose.ymlto point to Gitea [1]
Change your local container configuration so that instead of building in place, it pulls a tagged image hosted right inside your Gitea instance:
services:
custom-app:
# Point the image path directly to your self-hosted Gitea registry URL
image: gitea.homelab.local/${{ gitea.repository_owner }}/custom-app:latest
ports:
- "8080:80"
- Create the Build & Push Job Step
Add this block right before your deployment phase. Gitea Actions automatically exposes a temporary validation token (${{ gitea.token }}) for every run, which means you don't need to manually configure registry usernames or passwords in your secrets dashboard! [1]
build-and-push: runs-on: ubuntu-latest steps: - name: Checkout Code uses: actions/checkout@v4
# Log directly into your self-hosted Gitea Container Registry
- name: Log in to Gitea Registry
uses: https://github.com
with:
registry: gitea.homelab.local # Replace with your real homelab Gitea domain or local IP
username: ${{ gitea.actor }}
password: ${{ gitea.token }}
# Extract metadata to properly tag your image with the Git commit hash and "latest"
- name: Extract Docker Metadata
id: meta
uses: https://github.com
with:
images: gitea.homelab.local/${{ gitea.repository }}
tags: |
type=raw,value=latest
type=sha,value=${{ gitea.sha }}
# Build the Dockerfile and push it natively to Gitea
- name: Build and Push Docker Image
uses: https://github.com
with:
context: ./app_directory # Location of your Dockerfile
push: true
tags: ${{ steps.meta.outputs.tags }}