ci: workflow Forgejo Actions para publicar imagen en registry + compose por env var N8N_WEBHOOK_URL
Some checks failed
build-and-push-image / build (push) Has been cancelled

This commit is contained in:
JRike24 2026-06-27 21:35:48 -05:00
parent 4193336775
commit f0f6db06c9
5 changed files with 67 additions and 15 deletions

View file

@ -0,0 +1,32 @@
name: build-and-push-image
on:
push:
branches: [main]
workflow_dispatch:
jobs:
build:
runs-on: docker
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to Forgejo Container Registry
uses: docker/login-action@v3
with:
registry: forgejo.ikeforge.com
username: ${{ gitea.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push image
uses: docker/build-push-action@v6
with:
context: .
push: true
tags: |
forgejo.ikeforge.com/ike/webchatv2:latest
forgejo.ikeforge.com/ike/webchatv2:${{ gitea.sha }}

View file

@ -8,5 +8,8 @@ RUN npm run build
FROM nginx:1.27-alpine AS runtime FROM nginx:1.27-alpine AS runtime
COPY nginx.conf /etc/nginx/conf.d/default.conf COPY nginx.conf /etc/nginx/conf.d/default.conf
COPY --from=builder /app/dist /usr/share/nginx/html COPY --from=builder /app/dist /usr/share/nginx/html
COPY docker-entrypoint.sh /usr/local/bin/docker-entrypoint.sh
RUN chmod +x /usr/local/bin/docker-entrypoint.sh
EXPOSE 80 EXPOSE 80
ENTRYPOINT ["/usr/local/bin/docker-entrypoint.sh"]
CMD ["nginx", "-g", "daemon off;"] CMD ["nginx", "-g", "daemon off;"]

View file

@ -38,19 +38,26 @@ npm run build # typecheck + build -> dist/
Configura la URL del webhook en `public/config.js` (runtime) o `.env` Configura la URL del webhook en `public/config.js` (runtime) o `.env`
(`VITE_N8N_WEBHOOK_URL`). Ver `docs/N8N_CONTRACT.md` para el formato request/response. (`VITE_N8N_WEBHOOK_URL`). Ver `docs/N8N_CONTRACT.md` para el formato request/response.
## Docker (Dockge) ## Despliegue (Forgejo Actions + Dockge)
El archivo de compose es `compose.yaml` (nombre que Dockge reconoce por defecto). La imagen se construye y publica automáticamente en el **Container Registry de Forgejo**
En Dockge: crea un stack llamado `webchatv2` y copia el contenido del repo en su mediante Forgejo Actions (ver `.forgejo/workflows/build.yml`). En Dockge solo necesitas
carpeta (`~/.dockge/stacks/webchatv2/`), o clona el repo ahí. Dockge detectará el pegar este `compose.yaml`:
`compose.yaml` y podrás levantar/compilar desde la UI.
Por CLI equivalente: ```yaml
services:
```bash chat-ui:
docker compose -f compose.yaml up -d --build image: forgejo.ikeforge.com/ike/webchatv2:latest
container_name: webchatv2
restart: unless-stopped
ports:
- "8080:80"
environment:
- N8N_WEBHOOK_URL=https://n8n.ikeforge.com/webhook/chat
``` ```
Expone el sitio en `http://localhost:8080`. Para cambiar la URL del webhook sin - La imagen se actualiza sola con cada push a `main` ( Forgejo Actions la reconstruye y
reconstruir, edita `public/config.js` del repo (ya montado como volumen en publica como `forgejo.ikeforge.com/ike/webchatv2:latest`). En Dockge pulsa
`/usr/share/nginx/html/config.js`) y recarga la página. **Update / Deploy** para refrescar.
- La URL del webhook de n8n se configura con la env var `N8N_WEBHOOK_URL` directamente
desde el compose (sin reconstruir la imagen).

View file

@ -1,9 +1,9 @@
services: services:
chat-ui: chat-ui:
build: . image: forgejo.ikeforge.com/ike/webchatv2:latest
container_name: webchatv2 container_name: webchatv2
restart: unless-stopped restart: unless-stopped
ports: ports:
- "8080:80" - "8080:80"
volumes: environment:
- ./public/config.js:/usr/share/nginx/html/config.js:ro - N8N_WEBHOOK_URL=https://n8n.ikeforge.com/webhook/chat

10
docker-entrypoint.sh Normal file
View file

@ -0,0 +1,10 @@
#!/bin/sh
set -e
cat > /usr/share/nginx/html/config.js <<EOF
window.APP_CONFIG = {
N8N_WEBHOOK_URL: "${N8N_WEBHOOK_URL:-https://your-n8n-host/webhook/chat}"
};
EOF
exec nginx -g 'daemon off;'