Add automatic repository owner to image naming
- Use github.repository_owner in workflow - Image format: REGISTRY_URL/owner/APP_NAME:latest - Works automatically with Gitea registry - Template-friendly: forks use their own owner - Update documentation with new format
This commit is contained in:
@@ -10,7 +10,10 @@
|
|||||||
# REGISTRY & DEPLOYMENT
|
# REGISTRY & DEPLOYMENT
|
||||||
# ===========================================
|
# ===========================================
|
||||||
# URL del registro Docker (sin http:// ni https://)
|
# URL del registro Docker (sin http:// ni https://)
|
||||||
REGISTRY_URL=registry.ejemplo.com
|
# Para registry de Gitea: gitea.ejemplo.com
|
||||||
|
# El owner del repositorio se agrega automáticamente en el workflow
|
||||||
|
# Imagen final: REGISTRY_URL/owner/APP_NAME:latest
|
||||||
|
REGISTRY_URL=gitea.ejemplo.com
|
||||||
|
|
||||||
# Nombre de la aplicación (usado para container, imagen, y labels de Traefik)
|
# Nombre de la aplicación (usado para container, imagen, y labels de Traefik)
|
||||||
APP_NAME=mi-app
|
APP_NAME=mi-app
|
||||||
|
|||||||
@@ -23,9 +23,9 @@ jobs:
|
|||||||
- name: Build+push ${{ vars.APP_NAME }}
|
- name: Build+push ${{ vars.APP_NAME }}
|
||||||
run: |
|
run: |
|
||||||
cd nuxt4
|
cd nuxt4
|
||||||
docker build -t $REG/$APP_NAME:${{ github.sha }} -t $REG/$APP_NAME:latest .
|
docker build -t $REG/${{ github.repository_owner }}/$APP_NAME:${{ github.sha }} -t $REG/${{ github.repository_owner }}/$APP_NAME:latest .
|
||||||
docker push $REG/$APP_NAME:${{ github.sha }}
|
docker push $REG/${{ github.repository_owner }}/$APP_NAME:${{ github.sha }}
|
||||||
docker push $REG/$APP_NAME:latest
|
docker push $REG/${{ github.repository_owner }}/$APP_NAME:latest
|
||||||
|
|
||||||
#───────────────── deploy ─────────────────
|
#───────────────── deploy ─────────────────
|
||||||
deploy:
|
deploy:
|
||||||
@@ -33,6 +33,7 @@ jobs:
|
|||||||
runs-on: docker
|
runs-on: docker
|
||||||
env:
|
env:
|
||||||
REG: ${{ vars.REGISTRY_URL }}
|
REG: ${{ vars.REGISTRY_URL }}
|
||||||
|
REPO_OWNER: ${{ github.repository_owner }}
|
||||||
APP_NAME: ${{ vars.APP_NAME }}
|
APP_NAME: ${{ vars.APP_NAME }}
|
||||||
# Variables de entorno para docker-compose
|
# Variables de entorno para docker-compose
|
||||||
APP_DOMAIN: ${{ vars.APP_DOMAIN }}
|
APP_DOMAIN: ${{ vars.APP_DOMAIN }}
|
||||||
@@ -46,7 +47,7 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
echo "ℹ️ Deploying ${{ vars.APP_NAME }}"
|
echo "ℹ️ Deploying ${{ vars.APP_NAME }}"
|
||||||
echo " Domain: ${{ vars.APP_DOMAIN }}"
|
echo " Domain: ${{ vars.APP_DOMAIN }}"
|
||||||
echo " Registry: ${{ vars.REGISTRY_URL }}"
|
echo " Image: ${{ vars.REGISTRY_URL }}/${{ github.repository_owner }}/${{ vars.APP_NAME }}:latest"
|
||||||
echo " Network: principal"
|
echo " Network: principal"
|
||||||
|
|
||||||
- name: Pull fresh images used in compose
|
- name: Pull fresh images used in compose
|
||||||
|
|||||||
@@ -70,7 +70,9 @@ Para configurar el despliegue automático, ve a tu repositorio en Gitea:
|
|||||||
- `REGISTRY_PASSWORD` - Contraseña del registro Docker
|
- `REGISTRY_PASSWORD` - Contraseña del registro Docker
|
||||||
|
|
||||||
**Variables (valores públicos):**
|
**Variables (valores públicos):**
|
||||||
- `REGISTRY_URL` - URL del registro Docker (ej: `registry.ejemplo.com`)
|
- `REGISTRY_URL` - URL del registro Docker (ej: `gitea.nucleoriofrio.com`)
|
||||||
|
- El owner del repositorio se agrega automáticamente
|
||||||
|
- Imagen final: `REGISTRY_URL/owner/APP_NAME:latest`
|
||||||
- `APP_NAME` - Nombre de la aplicación (ej: `mi-app`) - usado para container, imagen y Traefik
|
- `APP_NAME` - Nombre de la aplicación (ej: `mi-app`) - usado para container, imagen y Traefik
|
||||||
- `APP_DOMAIN` - Dominio de la aplicación (ej: `miapp.ejemplo.com`)
|
- `APP_DOMAIN` - Dominio de la aplicación (ej: `miapp.ejemplo.com`)
|
||||||
- `NUXT_PUBLIC_APP_URL` - URL pública de la app (ej: `https://miapp.ejemplo.com`)
|
- `NUXT_PUBLIC_APP_URL` - URL pública de la app (ej: `https://miapp.ejemplo.com`)
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ version: '3.8'
|
|||||||
|
|
||||||
services:
|
services:
|
||||||
app:
|
app:
|
||||||
image: ${REG}/${APP_NAME}:latest
|
image: ${REG}/${REPO_OWNER}/${APP_NAME}:latest
|
||||||
container_name: ${APP_NAME}
|
container_name: ${APP_NAME}
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
environment:
|
environment:
|
||||||
|
|||||||
Reference in New Issue
Block a user