Skip to content

Commit ba9e76d

Browse files
feat(docker): aggiunge supporto immagini multi-architettura arm64 e amd64 con manifest workflow per build e push
1 parent 56b5606 commit ba9e76d

File tree

4 files changed

+125
-67
lines changed

4 files changed

+125
-67
lines changed

.claude/commands/build.md

Lines changed: 55 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
# Build Immagini Docker
1+
# Build Immagini Docker Multi-Architettura
22

3-
Builda le immagini Docker per linux/amd64 (compatibile con server cloud).
3+
Builda le immagini Docker per linux/amd64 (Ubuntu/cloud) e linux/arm64 (Mac M1/M2).
44

55
## Sintassi
66

@@ -34,34 +34,63 @@ Chiedi all'utente quale variante buildare:
3434
- `tika` - Dockerfile.tika (con Tika per PDF, ~4GB)
3535
- `both` - Entrambe
3636

37-
### Step 3: Esegui build
37+
### Step 3: Esegui build multi-arch
3838

39-
**Per variante base:**
39+
Per ogni variante, builda entrambe le architetture.
40+
41+
**Build arm64 (nativo su Mac, veloce):**
4042
```bash
41-
podman build --platform linux/amd64 \
42-
-t ghcr.io/strawberry-code/ragify:{version} \
43-
-t ghcr.io/strawberry-code/ragify:latest \
44-
-f Dockerfile .
43+
podman build --platform linux/arm64 \
44+
-t ghcr.io/strawberry-code/ragify:{version}-tika-arm64 \
45+
-f Dockerfile.tika .
4546
```
4647

47-
**Per variante tika:**
48+
**Build amd64 (emulato su Mac, lento ~10 min):**
4849
```bash
4950
podman build --platform linux/amd64 \
50-
-t ghcr.io/strawberry-code/ragify:{version}-tika \
51-
-t ghcr.io/strawberry-code/ragify:latest-tika \
51+
-t ghcr.io/strawberry-code/ragify:{version}-tika-amd64 \
5252
-f Dockerfile.tika .
5353
```
5454

55-
### Step 4: Verifica
55+
**NOTA:** Le due build possono essere eseguite in parallelo per risparmiare tempo.
56+
57+
### Step 4: Crea manifest multi-arch
58+
59+
```bash
60+
# Rimuovi manifest esistente se presente
61+
podman manifest rm ghcr.io/strawberry-code/ragify:{version}-tika 2>/dev/null || true
62+
63+
# Crea nuovo manifest
64+
podman manifest create ghcr.io/strawberry-code/ragify:{version}-tika
65+
66+
# Aggiungi le immagini
67+
podman manifest add ghcr.io/strawberry-code/ragify:{version}-tika \
68+
ghcr.io/strawberry-code/ragify:{version}-tika-arm64
69+
70+
podman manifest add ghcr.io/strawberry-code/ragify:{version}-tika \
71+
ghcr.io/strawberry-code/ragify:{version}-tika-amd64
72+
73+
# Crea anche manifest per latest
74+
podman manifest rm ghcr.io/strawberry-code/ragify:latest-tika 2>/dev/null || true
75+
podman manifest create ghcr.io/strawberry-code/ragify:latest-tika
76+
podman manifest add ghcr.io/strawberry-code/ragify:latest-tika \
77+
ghcr.io/strawberry-code/ragify:{version}-tika-arm64
78+
podman manifest add ghcr.io/strawberry-code/ragify:latest-tika \
79+
ghcr.io/strawberry-code/ragify:{version}-tika-amd64
80+
```
81+
82+
### Step 5: Verifica
5683

5784
```bash
5885
podman images | grep ragify
86+
podman manifest inspect ghcr.io/strawberry-code/ragify:{version}-tika
5987
```
6088

61-
### Step 5: Output
89+
### Step 6: Output
6290

6391
Mostra:
64-
- Tag creati
92+
- Tag creati per entrambe le architetture
93+
- Manifest multi-arch creati
6594
- Dimensione immagini
6695
- Prossimo comando: `/push-ghcr` o `/push-ghcr {version}`
6796

@@ -70,20 +99,23 @@ Mostra:
7099
## Esempio
71100

72101
```
73-
/build 1.1.0
102+
/build 1.1.3
74103
75-
Building ragify:1.1.0-tika...
76-
✓ ghcr.io/strawberry-code/ragify:1.1.0-tika
77-
✓ ghcr.io/strawberry-code/ragify:latest-tika
104+
Building ragify:1.1.3-tika (arm64 + amd64)...
105+
✓ ghcr.io/strawberry-code/ragify:1.1.3-tika-arm64
106+
✓ ghcr.io/strawberry-code/ragify:1.1.3-tika-amd64
107+
✓ Manifest: ghcr.io/strawberry-code/ragify:1.1.3-tika (multi-arch)
108+
✓ Manifest: ghcr.io/strawberry-code/ragify:latest-tika (multi-arch)
78109
79-
Prossimo step: /push-ghcr 1.1.0
110+
Prossimo step: /push-ghcr 1.1.3
80111
```
81112

82113
---
83114

84115
## Note
85116

86-
- Build usa `--platform linux/amd64` per compatibilità server
87-
- Il build può richiedere 5-10 minuti
88-
- Se il build fallisce per rete, riprovare
89-
- Usa `podman` (o `docker` se non disponibile)
117+
- Build arm64 è veloce su Mac (nativo)
118+
- Build amd64 usa emulazione QEMU (~10 min)
119+
- Le build usano cache per layer non modificati
120+
- Il manifest combina entrambe le architetture in un singolo tag
121+
- Docker/Podman seleziona automaticamente l'architettura corretta al pull

.claude/commands/push-ghcr.md

Lines changed: 44 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
# Push Immagini su GitHub Container Registry
1+
# Push Immagini Multi-Arch su GitHub Container Registry
22

3-
Pubblica le immagini Docker su ghcr.io/strawberry-code/ragify.
3+
Pubblica le immagini Docker multi-architettura su ghcr.io/strawberry-code/ragify.
44

55
## Sintassi
66

@@ -31,34 +31,46 @@ podman login ghcr.io -u strawberry-code
3131

3232
**Se NESSUN argomento:** push solo latest
3333

34-
### Step 2: Lista immagini disponibili
34+
### Step 2: Verifica immagini e manifest
3535

3636
```bash
37+
# Lista immagini locali
3738
podman images | grep ragify
38-
```
3939

40-
Verifica che le immagini da pushare esistano.
40+
# Verifica manifest esistenti
41+
podman manifest inspect ghcr.io/strawberry-code/ragify:{version}-tika 2>/dev/null
42+
```
4143

42-
### Step 3: Esegui push
44+
### Step 3: Esegui push dei manifest multi-arch
4345

44-
**Se versione specifica (es. 1.1.0):**
46+
**Se versione specifica (es. 1.1.3):**
4547
```bash
46-
# Base image
47-
podman push ghcr.io/strawberry-code/ragify:{version}
48-
podman push ghcr.io/strawberry-code/ragify:latest
48+
# Push manifest multi-arch (include arm64 + amd64)
49+
podman manifest push ghcr.io/strawberry-code/ragify:{version}-tika \
50+
docker://ghcr.io/strawberry-code/ragify:{version}-tika
4951

50-
# Tika image
51-
podman push ghcr.io/strawberry-code/ragify:{version}-tika
52-
podman push ghcr.io/strawberry-code/ragify:latest-tika
52+
podman manifest push ghcr.io/strawberry-code/ragify:latest-tika \
53+
docker://ghcr.io/strawberry-code/ragify:latest-tika
5354
```
5455

5556
**Se solo latest:**
5657
```bash
57-
podman push ghcr.io/strawberry-code/ragify:latest
58-
podman push ghcr.io/strawberry-code/ragify:latest-tika
58+
podman manifest push ghcr.io/strawberry-code/ragify:latest-tika \
59+
docker://ghcr.io/strawberry-code/ragify:latest-tika
5960
```
6061

61-
### Step 4: Verifica tag git
62+
### Step 4: Verifica su GHCR
63+
64+
```bash
65+
# Verifica manifest remoto
66+
podman manifest inspect docker://ghcr.io/strawberry-code/ragify:{version}-tika
67+
```
68+
69+
Dovresti vedere entrambe le architetture:
70+
- `linux/amd64`
71+
- `linux/arm64`
72+
73+
### Step 5: Verifica tag git
6274

6375
Se è stata fatta una release con `/commit patch|minor|major`, verifica che il tag git sia stato pushato:
6476

@@ -72,21 +84,22 @@ Se il tag locale esiste ma non è su origin, chiedi se pusharlo:
7284
git push origin v{version}
7385
```
7486

75-
### Step 5: Output
87+
### Step 6: Output
7688

7789
Mostra:
78-
- Immagini pubblicate
90+
- Manifest pubblicati con architetture supportate
7991
- URL GHCR: `ghcr.io/strawberry-code/ragify`
8092
- Comando pull: `docker pull ghcr.io/strawberry-code/ragify:latest-tika`
81-
- Comandi per deploy su server
93+
- Nota: Docker/Podman seleziona automaticamente l'architettura corretta
8294

8395
---
8496

8597
## Troubleshooting
8698

8799
**Errore TLS:**
88100
```bash
89-
podman push --tls-verify=false ghcr.io/strawberry-code/ragify:latest-tika
101+
podman manifest push --tls-verify=false ghcr.io/strawberry-code/ragify:latest-tika \
102+
docker://ghcr.io/strawberry-code/ragify:latest-tika
90103
```
91104

92105
**Errore autenticazione:**
@@ -95,22 +108,25 @@ podman login ghcr.io -u strawberry-code
95108
# Token: ghp_... (con scope write:packages)
96109
```
97110

111+
**Manifest non trovato:**
112+
Prima esegui `/build {version}` per creare le immagini e i manifest.
113+
98114
---
99115

100116
## Esempio
101117

102118
```
103-
/push-ghcr 1.1.0
119+
/push-ghcr 1.1.3
104120
105-
Pushing images...
106-
✓ ghcr.io/strawberry-code/ragify:1.1.0
107-
✓ ghcr.io/strawberry-code/ragify:latest
108-
✓ ghcr.io/strawberry-code/ragify:1.1.0-tika
109-
✓ ghcr.io/strawberry-code/ragify:latest-tika
121+
Pushing multi-arch manifests...
122+
✓ ghcr.io/strawberry-code/ragify:1.1.3-tika (linux/amd64, linux/arm64)
123+
✓ ghcr.io/strawberry-code/ragify:latest-tika (linux/amd64, linux/arm64)
110124
111-
Git tag v1.1.0 pushed to origin.
125+
Git tag v1.1.3 pushed to origin.
112126
113-
Deploy su server:
127+
Deploy su server (Ubuntu o Mac):
114128
docker pull ghcr.io/strawberry-code/ragify:latest-tika
115129
docker compose down && docker compose up -d
130+
131+
L'architettura corretta viene selezionata automaticamente.
116132
```

CHANGELOG.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,13 @@ and the project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.
77

88
## [Unreleased]
99

10+
### Added
11+
- Multi-arch Docker images support (linux/amd64 + linux/arm64) for Ubuntu and Mac compatibility
12+
- Updated `/build` and `/push-ghcr` slash commands for multi-arch manifest workflow
13+
1014
### Fixed
11-
- Dockerfile.tika Tika pre-download script now uses heredoc for proper Python syntax
15+
- Dockerfile.tika Tika pre-download script now uses heredoc and handles versioned JAR names
16+
- Removed obsolete mcp_server.py reference from Dockerfiles
1217

1318
## [1.1.3] - 2025-12-02
1419

Dockerfile.tika

Lines changed: 20 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -85,24 +85,29 @@ RUN ollama serve & \
8585
# Pre-download Tika JAR and ensure it's in the expected location
8686
RUN python3 <<'PYEOF'
8787
import os
88-
import shutil
89-
from tika import parser, tika
88+
import glob
89+
from tika import parser
9090

91-
# Trigger download
91+
# Trigger download (this downloads JAR to /tmp/)
9292
parser.from_buffer(b'test', xmlContent=False)
9393

94-
# Get the actual JAR path
95-
jar_path = getattr(tika, 'TikaJarPath', None)
96-
print(f'Tika JAR downloaded to: {jar_path}')
97-
98-
# Copy to expected location if different
99-
if jar_path and os.path.exists(jar_path) and jar_path != '/tmp/tika-server.jar':
100-
shutil.copy2(jar_path, '/tmp/tika-server.jar')
101-
print('Copied to /tmp/tika-server.jar')
102-
103-
# Verify
104-
assert os.path.exists('/tmp/tika-server.jar'), 'Tika JAR not found at /tmp/tika-server.jar'
105-
print('Tika JAR verified at /tmp/tika-server.jar')
94+
# Find the JAR file (handles versioned names like tika-server-standard-3.1.0.jar)
95+
expected_path = '/tmp/tika-server.jar'
96+
if os.path.exists(expected_path):
97+
print(f'Tika JAR found at {expected_path}')
98+
else:
99+
# Search for versioned JAR
100+
jars = glob.glob('/tmp/tika-server*.jar')
101+
if jars:
102+
print(f'Found JAR: {jars[0]}')
103+
os.symlink(jars[0], expected_path)
104+
print(f'Created symlink: {expected_path} -> {jars[0]}')
105+
else:
106+
raise Exception('No Tika JAR found in /tmp/')
107+
108+
# Final verification
109+
assert os.path.exists(expected_path), f'Tika JAR not found at {expected_path}'
110+
print(f'Tika JAR verified at {expected_path}')
106111
PYEOF
107112

108113
# Create data directory for Qdrant

0 commit comments

Comments
 (0)