migrate
This commit is contained in:
@@ -0,0 +1,56 @@
|
||||
---
|
||||
tags:
|
||||
- GIT
|
||||
- CI/CD
|
||||
- CI-CD
|
||||
---
|
||||
|
||||
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.
|
||||
|
||||
1. Update your `docker-compose.yml` to point to Gitea [[1](https://forum.gitea.com/t/strange-behavior-when-upgrading-to-1-22-1-from-1-15-9/9664)]
|
||||
|
||||
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"
|
||||
|
||||
2. 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](https://docs.gitlab.com/user/packages/container_registry/authenticate_with_container_registry/)]
|
||||
|
||||
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 }}
|
||||
|
||||
Reference in New Issue
Block a user