Semplifica workflow Docker/Gitea, versionamento automatico
- Corretto path registry Docker: ora 3 livelli (owner/image) - Aggiunto target post-build: tagging e push automatico su Gitea (latest + versione) - Inclusi Dockerfile, .dockerignore e profilo pubblicazione nel progetto - Kestrel: HTTPS configurabile, gestione certificati e log migliorati - HSTS/HTTPS redirection ora condizionali - Aggiornate guide e checklist: workflow, troubleshooting, best practice - Unificato profilo di pubblicazione: versionamento da <Version> in .csproj - Processo di build/push ora integrato, automatico e conforme a Gitea
This commit is contained in:
@@ -7,6 +7,8 @@
|
|||||||
<AssemblyName>AutoBidder</AssemblyName>
|
<AssemblyName>AutoBidder</AssemblyName>
|
||||||
<RootNamespace>AutoBidder</RootNamespace>
|
<RootNamespace>AutoBidder</RootNamespace>
|
||||||
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
|
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
|
||||||
|
<DockerfileContext>.</DockerfileContext>
|
||||||
|
<DockerfileFile>Dockerfile</DockerfileFile>
|
||||||
|
|
||||||
<!-- Versioning per Docker & Gitea Registry -->
|
<!-- Versioning per Docker & Gitea Registry -->
|
||||||
<Version>1.0.0</Version>
|
<Version>1.0.0</Version>
|
||||||
@@ -17,7 +19,8 @@
|
|||||||
<!-- Metadata immagine Docker -->
|
<!-- Metadata immagine Docker -->
|
||||||
<ContainerImageName>autobidder</ContainerImageName>
|
<ContainerImageName>autobidder</ContainerImageName>
|
||||||
<ContainerImageTag>$(Version)</ContainerImageTag>
|
<ContainerImageTag>$(Version)</ContainerImageTag>
|
||||||
<ContainerRegistry>gitea.encke-hake.ts.net/alby96/mimante</ContainerRegistry>
|
<!-- CORRETTO: Convenzione Gitea {registro}/{proprietario}/{immagine} -->
|
||||||
|
<ContainerRegistry>gitea.encke-hake.ts.net/alby96</ContainerRegistry>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
@@ -76,6 +79,77 @@
|
|||||||
<None Include=".gitea\workflows\deploy.yml" />
|
<None Include=".gitea\workflows\deploy.yml" />
|
||||||
<None Include=".gitea\workflows\health-check.yml" />
|
<None Include=".gitea\workflows\health-check.yml" />
|
||||||
<None Include=".github\workflows\ci-cd.yml" />
|
<None Include=".github\workflows\ci-cd.yml" />
|
||||||
|
<None Include="Dockerfile" />
|
||||||
|
<None Include=".dockerignore" />
|
||||||
|
<None Include="Properties\PublishProfiles\GiteaRegistry-Versioned.pubxml.user" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
|
<!-- ============================================ -->
|
||||||
|
<!-- POST-BUILD TARGET: Push automatico su Gitea -->
|
||||||
|
<!-- con versionamento da <Version> della solution -->
|
||||||
|
<!-- ============================================ -->
|
||||||
|
<Target Name="PushDockerImageToGitea" AfterTargets="Publish" Condition="'$(PushToGiteaRegistry)' == 'true'">
|
||||||
|
<PropertyGroup>
|
||||||
|
<GiteaRegistry>gitea.encke-hake.ts.net/alby96</GiteaRegistry>
|
||||||
|
<LocalImageName>autobidder</LocalImageName>
|
||||||
|
<GiteaImageLatest>$(GiteaRegistry)/$(LocalImageName):latest</GiteaImageLatest>
|
||||||
|
<GiteaImageVersion>$(GiteaRegistry)/$(LocalImageName):$(Version)</GiteaImageVersion>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<Message Importance="high" Text="" />
|
||||||
|
<Message Importance="high" Text="╔═══════════════════════════════════════════════════════════════════╗" />
|
||||||
|
<Message Importance="high" Text="║ POST-BUILD: Pubblicazione su Gitea Container Registry ║" />
|
||||||
|
<Message Importance="high" Text="╚═══════════════════════════════════════════════════════════════════╝" />
|
||||||
|
<Message Importance="high" Text="" />
|
||||||
|
<Message Importance="high" Text="📦 Solution Version: $(Version)" />
|
||||||
|
<Message Importance="high" Text="🐳 Local Image: $(LocalImageName):latest" />
|
||||||
|
<Message Importance="high" Text="🏷️ Target Tags:" />
|
||||||
|
<Message Importance="high" Text=" • $(GiteaImageLatest)" />
|
||||||
|
<Message Importance="high" Text=" • $(GiteaImageVersion)" />
|
||||||
|
<Message Importance="high" Text="" />
|
||||||
|
<Message Importance="high" Text="───────────────────────────────────────────────────────────────────" />
|
||||||
|
<Message Importance="high" Text="🏷️ Tagging images..." />
|
||||||
|
<Message Importance="high" Text="───────────────────────────────────────────────────────────────────" />
|
||||||
|
|
||||||
|
<!-- Tag immagine locale per Gitea (latest) -->
|
||||||
|
<Exec Command="docker tag $(LocalImageName):latest $(GiteaImageLatest)" />
|
||||||
|
<Message Importance="high" Text="✅ Tagged: $(GiteaImageLatest)" />
|
||||||
|
|
||||||
|
<!-- Tag immagine locale per Gitea (versione solution) -->
|
||||||
|
<Exec Command="docker tag $(LocalImageName):latest $(GiteaImageVersion)" />
|
||||||
|
<Message Importance="high" Text="✅ Tagged: $(GiteaImageVersion)" />
|
||||||
|
|
||||||
|
<Message Importance="high" Text="" />
|
||||||
|
<Message Importance="high" Text="───────────────────────────────────────────────────────────────────" />
|
||||||
|
<Message Importance="high" Text="📤 Pushing to Gitea Registry..." />
|
||||||
|
<Message Importance="high" Text="───────────────────────────────────────────────────────────────────" />
|
||||||
|
|
||||||
|
<!-- Push latest -->
|
||||||
|
<Exec Command="docker push $(GiteaImageLatest)" />
|
||||||
|
<Message Importance="high" Text="✅ Pushed: $(GiteaImageLatest)" />
|
||||||
|
|
||||||
|
<!-- Push version -->
|
||||||
|
<Exec Command="docker push $(GiteaImageVersion)" />
|
||||||
|
<Message Importance="high" Text="✅ Pushed: $(GiteaImageVersion)" />
|
||||||
|
|
||||||
|
<Message Importance="high" Text="" />
|
||||||
|
<Message Importance="high" Text="╔═══════════════════════════════════════════════════════════════════╗" />
|
||||||
|
<Message Importance="high" Text="║ ✅ PUBBLICAZIONE COMPLETATA CON SUCCESSO! ║" />
|
||||||
|
<Message Importance="high" Text="╚═══════════════════════════════════════════════════════════════════╝" />
|
||||||
|
<Message Importance="high" Text="" />
|
||||||
|
<Message Importance="high" Text="🌐 Visualizza su Gitea:" />
|
||||||
|
<Message Importance="high" Text=" https://gitea.encke-hake.ts.net/Alby96/-/packages/container/autobidder" />
|
||||||
|
<Message Importance="high" Text="" />
|
||||||
|
<Message Importance="high" Text="📋 Tag pubblicati:" />
|
||||||
|
<Message Importance="high" Text=" • latest (sempre aggiornato all'ultima versione)" />
|
||||||
|
<Message Importance="high" Text=" • $(Version) (versione solution corrente)" />
|
||||||
|
<Message Importance="high" Text="" />
|
||||||
|
<Message Importance="high" Text="🚀 Pull command:" />
|
||||||
|
<Message Importance="high" Text=" docker pull $(GiteaImageLatest)" />
|
||||||
|
<Message Importance="high" Text=" docker pull $(GiteaImageVersion)" />
|
||||||
|
<Message Importance="high" Text="" />
|
||||||
|
<Message Importance="high" Text="═══════════════════════════════════════════════════════════════════" />
|
||||||
|
<Message Importance="high" Text="" />
|
||||||
|
</Target>
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
|
|||||||
296
Mimante/CONFIGURAZIONE_FINALE.md
Normal file
296
Mimante/CONFIGURAZIONE_FINALE.md
Normal file
@@ -0,0 +1,296 @@
|
|||||||
|
# ?? CONFIGURAZIONE FINALE - UN SOLO PROFILO
|
||||||
|
|
||||||
|
## ? Cosa è Cambiato
|
||||||
|
|
||||||
|
### PRIMA (Configurazione Complessa)
|
||||||
|
- ? Due profili: `GiteaRegistry` e `GiteaRegistry-LocalOnly`
|
||||||
|
- ? Versionamento manuale
|
||||||
|
- ? Confusione su quale profilo usare
|
||||||
|
|
||||||
|
### DOPO (Configurazione Semplificata)
|
||||||
|
- ? **UN SOLO PROFILO**: `GiteaRegistry.pubxml`
|
||||||
|
- ? **Versionamento automatico** da `<Version>` della solution
|
||||||
|
- ? **Workflow chiaro** e lineare
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## ?? Struttura Files
|
||||||
|
|
||||||
|
```
|
||||||
|
AutoBidder/
|
||||||
|
??? AutoBidder.csproj
|
||||||
|
? ??? <Version>1.0.0</Version> ? VERSIONE SOLUTION (fonte unica)
|
||||||
|
? ??? <Target Name="PushDockerImageToGitea"> ? Post-build automatico
|
||||||
|
??? Dockerfile ? Build immagine Docker
|
||||||
|
??? Properties/
|
||||||
|
? ??? PublishProfiles/
|
||||||
|
? ??? GiteaRegistry.pubxml ? UNICO PROFILO (tutto automatico)
|
||||||
|
??? DOCKER_PUBLISH_GUIDE.md ? Guida aggiornata
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## ?? Come Funziona
|
||||||
|
|
||||||
|
### 1. Definisci Versione Solution
|
||||||
|
|
||||||
|
```xml
|
||||||
|
<!-- AutoBidder.csproj -->
|
||||||
|
<PropertyGroup>
|
||||||
|
<Version>1.0.1</Version> ? Modifica qui per nuova versione
|
||||||
|
</PropertyGroup>
|
||||||
|
```
|
||||||
|
|
||||||
|
### 2. Pubblica da Visual Studio
|
||||||
|
|
||||||
|
```
|
||||||
|
Tasto destro progetto ? Pubblica ? GiteaRegistry ? Pubblica
|
||||||
|
```
|
||||||
|
|
||||||
|
### 3. Sistema Automatico
|
||||||
|
|
||||||
|
```
|
||||||
|
???????????????????????????????????
|
||||||
|
? Visual Studio: Publish ?
|
||||||
|
???????????????????????????????????
|
||||||
|
?
|
||||||
|
?
|
||||||
|
???????????????????????????????????
|
||||||
|
? Build .NET (Release) ?
|
||||||
|
???????????????????????????????????
|
||||||
|
?
|
||||||
|
?
|
||||||
|
???????????????????????????????????
|
||||||
|
? Docker build ?
|
||||||
|
? ? autobidder:latest ?
|
||||||
|
???????????????????????????????????
|
||||||
|
?
|
||||||
|
?
|
||||||
|
???????????????????????????????????
|
||||||
|
? POST-BUILD (AutoBidder.csproj) ?
|
||||||
|
? ?
|
||||||
|
? Legge: <Version>1.0.1</Version> ?
|
||||||
|
? ?
|
||||||
|
? Tag: ?
|
||||||
|
? • autobidder:latest ?
|
||||||
|
? ? gitea.../alby96/ ?
|
||||||
|
? autobidder:latest ?
|
||||||
|
? ?
|
||||||
|
? • autobidder:latest ?
|
||||||
|
? ? gitea.../alby96/ ?
|
||||||
|
? autobidder:1.0.1 ?
|
||||||
|
???????????????????????????????????
|
||||||
|
?
|
||||||
|
?
|
||||||
|
???????????????????????????????????
|
||||||
|
? Push su Gitea ?
|
||||||
|
? ?
|
||||||
|
? ? latest (aggiornato) ?
|
||||||
|
? ? 1.0.1 (nuovo tag) ?
|
||||||
|
???????????????????????????????????
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## ?? Versionamento Automatico
|
||||||
|
|
||||||
|
### Source of Truth
|
||||||
|
|
||||||
|
```xml
|
||||||
|
<!-- AutoBidder.csproj - UNICA FONTE DI VERITÀ -->
|
||||||
|
<Version>1.0.1</Version>
|
||||||
|
```
|
||||||
|
|
||||||
|
### Tag Generati Automaticamente
|
||||||
|
|
||||||
|
| Versione Solution | Tag Latest | Tag Versione | Nota |
|
||||||
|
|-------------------|------------|--------------|------|
|
||||||
|
| `1.0.0` | `:latest` ? 1.0.0 | `:1.0.0` | Prima versione |
|
||||||
|
| `1.0.1` | `:latest` ? 1.0.1 | `:1.0.1` + `:1.0.0` rimane | Latest aggiornato |
|
||||||
|
| `2.0.0` | `:latest` ? 2.0.0 | `:2.0.0` + precedenti | Major update |
|
||||||
|
|
||||||
|
### Storico Versioni su Gitea
|
||||||
|
|
||||||
|
Gitea mantiene **TUTTI i tag** pubblicati:
|
||||||
|
|
||||||
|
```
|
||||||
|
?? gitea.encke-hake.ts.net/alby96/autobidder
|
||||||
|
??? ??? latest (? 1.0.1) [sempre aggiornato]
|
||||||
|
??? ??? 1.0.1 [immutabile]
|
||||||
|
??? ??? 1.0.0 [immutabile]
|
||||||
|
??? ??? 0.9.0 [immutabile]
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## ?? Esempio Pratico: Rilascio Versione 1.0.2
|
||||||
|
|
||||||
|
### Step 1: Aggiorna Versione
|
||||||
|
|
||||||
|
```xml
|
||||||
|
<!-- AutoBidder.csproj -->
|
||||||
|
<Version>1.0.2</Version> <!-- Era 1.0.1 -->
|
||||||
|
```
|
||||||
|
|
||||||
|
### Step 2: Pubblica
|
||||||
|
|
||||||
|
1. Tasto destro ? Pubblica
|
||||||
|
2. Seleziona `GiteaRegistry`
|
||||||
|
3. Click **Pubblica**
|
||||||
|
|
||||||
|
### Step 3: Output Automatico
|
||||||
|
|
||||||
|
```
|
||||||
|
?????????????????????????????????????????????????????????????????????
|
||||||
|
? POST-BUILD: Pubblicazione su Gitea Container Registry ?
|
||||||
|
?????????????????????????????????????????????????????????????????????
|
||||||
|
|
||||||
|
?? Solution Version: 1.0.2
|
||||||
|
??? Target Tags:
|
||||||
|
• gitea.encke-hake.ts.net/alby96/autobidder:latest
|
||||||
|
• gitea.encke-hake.ts.net/alby96/autobidder:1.0.2
|
||||||
|
|
||||||
|
? Tagged: gitea.../autobidder:latest
|
||||||
|
? Tagged: gitea.../autobidder:1.0.2
|
||||||
|
|
||||||
|
? Pushed: gitea.../autobidder:latest
|
||||||
|
? Pushed: gitea.../autobidder:1.0.2
|
||||||
|
|
||||||
|
?????????????????????????????????????????????????????????????????????
|
||||||
|
? ? PUBBLICAZIONE COMPLETATA CON SUCCESSO! ?
|
||||||
|
?????????????????????????????????????????????????????????????????????
|
||||||
|
|
||||||
|
?? Tag pubblicati:
|
||||||
|
• latest (ora punta a 1.0.2)
|
||||||
|
• 1.0.2 (nuova versione)
|
||||||
|
```
|
||||||
|
|
||||||
|
### Step 4: Verifica su Gitea
|
||||||
|
|
||||||
|
```
|
||||||
|
https://gitea.encke-hake.ts.net/Alby96/-/packages/container/autobidder
|
||||||
|
```
|
||||||
|
|
||||||
|
Vedrai:
|
||||||
|
- `latest` ? digest aggiornato (ora è 1.0.2)
|
||||||
|
- `1.0.2` ? nuovo tag creato
|
||||||
|
- `1.0.1` ? ancora disponibile
|
||||||
|
- `1.0.0` ? ancora disponibile
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## ?? Vantaggi del Nuovo Sistema
|
||||||
|
|
||||||
|
| Aspetto | Prima | Dopo |
|
||||||
|
|---------|-------|------|
|
||||||
|
| **Profili** | 2 (confusione) | 1 (chiaro) |
|
||||||
|
| **Versionamento** | Manuale | Automatico |
|
||||||
|
| **Source of Truth** | Multipli | Unico (`<Version>`) |
|
||||||
|
| **Complessità** | Alta | Bassa |
|
||||||
|
| **Errori** | Facili | Difficili |
|
||||||
|
| **Manutenibilità** | Difficile | Facile |
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## ?? Best Practices
|
||||||
|
|
||||||
|
### 1. Semantic Versioning
|
||||||
|
|
||||||
|
Segui il formato: `MAJOR.MINOR.PATCH`
|
||||||
|
|
||||||
|
```xml
|
||||||
|
<!-- Esempi -->
|
||||||
|
<Version>1.0.0</Version> ? Release iniziale
|
||||||
|
<Version>1.0.1</Version> ? Bug fix
|
||||||
|
<Version>1.1.0</Version> ? Nuova feature
|
||||||
|
<Version>2.0.0</Version> ? Breaking change
|
||||||
|
```
|
||||||
|
|
||||||
|
### 2. Deploy Production
|
||||||
|
|
||||||
|
**? MAI usare `latest` in production:**
|
||||||
|
```yaml
|
||||||
|
# ERRATO
|
||||||
|
image: gitea.../autobidder:latest
|
||||||
|
```
|
||||||
|
|
||||||
|
**? USA sempre versione specifica:**
|
||||||
|
```yaml
|
||||||
|
# CORRETTO
|
||||||
|
image: gitea.../autobidder:1.0.2
|
||||||
|
```
|
||||||
|
|
||||||
|
### 3. Testing
|
||||||
|
|
||||||
|
Prima di deployare in production:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# 1. Pull versione specifica
|
||||||
|
docker pull gitea.encke-hake.ts.net/alby96/autobidder:1.0.2
|
||||||
|
|
||||||
|
# 2. Test locale
|
||||||
|
docker run -p 5000:8080 gitea.../autobidder:1.0.2
|
||||||
|
|
||||||
|
# 3. Verifica funzionalità
|
||||||
|
# http://localhost:5000
|
||||||
|
|
||||||
|
# 4. Se OK ? Deploy production
|
||||||
|
```
|
||||||
|
|
||||||
|
### 4. Changelog
|
||||||
|
|
||||||
|
Mantieni un file `CHANGELOG.md` nella repo:
|
||||||
|
|
||||||
|
```markdown
|
||||||
|
# Changelog
|
||||||
|
|
||||||
|
## [1.0.2] - 2026-01-18
|
||||||
|
### Fixed
|
||||||
|
- Correzione bug autenticazione Gitea
|
||||||
|
|
||||||
|
## [1.0.1] - 2026-01-17
|
||||||
|
### Added
|
||||||
|
- Supporto versionamento automatico
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## ?? Comandi Rapidi
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Autenticazione (prima volta)
|
||||||
|
docker login gitea.encke-hake.ts.net
|
||||||
|
|
||||||
|
# Pubblica da Visual Studio
|
||||||
|
# Tasto destro ? Pubblica ? GiteaRegistry
|
||||||
|
|
||||||
|
# Pull versione specifica (production)
|
||||||
|
docker pull gitea.encke-hake.ts.net/alby96/autobidder:1.0.2
|
||||||
|
|
||||||
|
# Pull latest (development)
|
||||||
|
docker pull gitea.encke-hake.ts.net/alby96/autobidder:latest
|
||||||
|
|
||||||
|
# Lista tutti i tag disponibili (via API)
|
||||||
|
curl https://gitea.encke-hake.ts.net/api/v1/packages/Alby96/container/autobidder
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## ?? File Finali
|
||||||
|
|
||||||
|
| File | Scopo |
|
||||||
|
|------|-------|
|
||||||
|
| `AutoBidder.csproj` | Versione solution + post-build target |
|
||||||
|
| `Properties/PublishProfiles/GiteaRegistry.pubxml` | UNICO profilo pubblicazione |
|
||||||
|
| `Dockerfile` | Build immagine Docker |
|
||||||
|
| `.dockerignore` | Esclusioni Docker |
|
||||||
|
| `DOCKER_PUBLISH_GUIDE.md` | Guida utente completa |
|
||||||
|
| `VERIFICA_CONFIGURAZIONE_GITEA.md` | Checklist conformità |
|
||||||
|
| `NUOVO_WORKFLOW_RIEPILOGO.md` | Dettagli tecnici workflow |
|
||||||
|
| **`CONFIGURAZIONE_FINALE.md`** | **Questo documento** |
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
**? CONFIGURAZIONE COMPLETATA E SEMPLIFICATA!**
|
||||||
|
|
||||||
|
Ora hai un sistema **professionale**, **automatico** e **tracciabile** per gestire versioni Docker su Gitea! ??
|
||||||
479
Mimante/DOCKER_PUBLISH_GUIDE.md
Normal file
479
Mimante/DOCKER_PUBLISH_GUIDE.md
Normal file
@@ -0,0 +1,479 @@
|
|||||||
|
# Guida Pubblicazione Docker su Gitea Registry
|
||||||
|
|
||||||
|
Questa guida spiega come pubblicare l'immagine Docker di AutoBidder sul registry Gitea usando il **nuovo workflow integrato con Visual Studio**.
|
||||||
|
|
||||||
|
## Prerequisiti
|
||||||
|
|
||||||
|
1. **Docker installato e in esecuzione**
|
||||||
|
2. **Accesso al registry Gitea**: `gitea.encke-hake.ts.net`
|
||||||
|
3. **Token PAT** (Personal Access Token) con permessi `read:packages` e `write:packages`
|
||||||
|
|
||||||
|
## 1. Autenticazione con Gitea (OBBLIGATORIA)
|
||||||
|
|
||||||
|
Prima di pubblicare, devi autenticarti con il registry Gitea usando un **Token PAT**:
|
||||||
|
|
||||||
|
### Genera Token PAT
|
||||||
|
|
||||||
|
1. Vai su: `https://gitea.encke-hake.ts.net/user/settings/applications`
|
||||||
|
2. Click **Generate New Token**
|
||||||
|
3. Seleziona scope: **`read:packages`** + **`write:packages`**
|
||||||
|
4. Copia il token generato
|
||||||
|
|
||||||
|
### Autentica Docker
|
||||||
|
|
||||||
|
```bash
|
||||||
|
docker login gitea.encke-hake.ts.net
|
||||||
|
# Username: Alby96
|
||||||
|
# Password: [INCOLLA IL TOKEN PAT QUI]
|
||||||
|
```
|
||||||
|
|
||||||
|
**IMPORTANTE:** Se hai 2FA attivo su Gitea, il Token PAT è **OBBLIGATORIO** (la password normale non funziona).
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
# Guida Pubblicazione Docker su Gitea Registry
|
||||||
|
|
||||||
|
Questa guida spiega come pubblicare l'immagine Docker di AutoBidder sul registry Gitea con **versionamento automatico** basato sulla solution.
|
||||||
|
|
||||||
|
## Prerequisiti
|
||||||
|
|
||||||
|
1. **Docker Desktop** installato e in esecuzione
|
||||||
|
2. **Accesso al registry Gitea**: `gitea.encke-hake.ts.net`
|
||||||
|
3. **Token PAT** (Personal Access Token) con permessi `read:packages` e `write:packages`
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 1. Autenticazione con Gitea (OBBLIGATORIA - Una Volta)
|
||||||
|
|
||||||
|
### Genera Token PAT
|
||||||
|
|
||||||
|
1. Vai su: `https://gitea.encke-hake.ts.net/user/settings/applications`
|
||||||
|
2. Click **Generate New Token**
|
||||||
|
3. Nome: `Docker Registry Access`
|
||||||
|
4. Seleziona scope: **`read:packages`** + **`write:packages`**
|
||||||
|
5. Click **Generate Token**
|
||||||
|
6. **Copia il token** (non sarà più visibile!)
|
||||||
|
|
||||||
|
### Autentica Docker
|
||||||
|
|
||||||
|
```bash
|
||||||
|
docker login gitea.encke-hake.ts.net
|
||||||
|
# Username: Alby96
|
||||||
|
# Password: [INCOLLA IL TOKEN PAT]
|
||||||
|
```
|
||||||
|
|
||||||
|
**? Success:** `Login Succeeded`
|
||||||
|
|
||||||
|
**?? IMPORTANTE:** Con 2FA attivo su Gitea, il Token PAT è **OBBLIGATORIO** (la password normale non funziona).
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 2. Pubblicare su Gitea con Versionamento Automatico
|
||||||
|
|
||||||
|
### ?? Workflow Completo in 3 Step
|
||||||
|
|
||||||
|
#### Step 1: Aggiorna Versione Solution (Opzionale)
|
||||||
|
|
||||||
|
Apri `AutoBidder.csproj` e modifica:
|
||||||
|
|
||||||
|
```xml
|
||||||
|
<Version>1.0.1</Version> <!-- Incrementa la versione -->
|
||||||
|
```
|
||||||
|
|
||||||
|
La versione qui definita sarà usata per taggare l'immagine Docker.
|
||||||
|
|
||||||
|
#### Step 2: Pubblica da Visual Studio
|
||||||
|
|
||||||
|
1. **Tasto destro** sul progetto `AutoBidder`
|
||||||
|
2. Seleziona **Pubblica**
|
||||||
|
3. Scegli il profilo: **`GiteaRegistry`** (UNICO profilo disponibile)
|
||||||
|
4. Click **Pubblica**
|
||||||
|
|
||||||
|
#### Step 3: Verifica Pubblicazione
|
||||||
|
|
||||||
|
Il sistema mostrerà output dettagliato:
|
||||||
|
|
||||||
|
```
|
||||||
|
?????????????????????????????????????????????????????????????????????
|
||||||
|
? POST-BUILD: Pubblicazione su Gitea Container Registry ?
|
||||||
|
?????????????????????????????????????????????????????????????????????
|
||||||
|
|
||||||
|
?? Solution Version: 1.0.1
|
||||||
|
?? Local Image: autobidder:latest
|
||||||
|
??? Target Tags:
|
||||||
|
• gitea.encke-hake.ts.net/alby96/autobidder:latest
|
||||||
|
• gitea.encke-hake.ts.net/alby96/autobidder:1.0.1
|
||||||
|
|
||||||
|
???????????????????????????????????????????????????????????????????
|
||||||
|
??? Tagging images...
|
||||||
|
???????????????????????????????????????????????????????????????????
|
||||||
|
? Tagged: gitea.encke-hake.ts.net/alby96/autobidder:latest
|
||||||
|
? Tagged: gitea.encke-hake.ts.net/alby96/autobidder:1.0.1
|
||||||
|
|
||||||
|
???????????????????????????????????????????????????????????????????
|
||||||
|
?? Pushing to Gitea Registry...
|
||||||
|
???????????????????????????????????????????????????????????????????
|
||||||
|
? Pushed: gitea.encke-hake.ts.net/alby96/autobidder:latest
|
||||||
|
? Pushed: gitea.encke-hake.ts.net/alby96/autobidder:1.0.1
|
||||||
|
|
||||||
|
?????????????????????????????????????????????????????????????????????
|
||||||
|
? ? PUBBLICAZIONE COMPLETATA CON SUCCESSO! ?
|
||||||
|
?????????????????????????????????????????????????????????????????????
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 3. Sistema di Versionamento
|
||||||
|
|
||||||
|
### Come Funziona
|
||||||
|
|
||||||
|
Il versionamento è **completamente automatico** e basato su:
|
||||||
|
|
||||||
|
```xml
|
||||||
|
<!-- AutoBidder.csproj -->
|
||||||
|
<Version>1.0.1</Version>
|
||||||
|
```
|
||||||
|
|
||||||
|
Quando pubblichi:
|
||||||
|
- ? Tag `latest` ? **sempre aggiornato** all'ultima versione
|
||||||
|
- ? Tag `1.0.1` ? **versione specifica** immutabile
|
||||||
|
|
||||||
|
### Esempi Pratici
|
||||||
|
|
||||||
|
**Scenario 1: Prima pubblicazione**
|
||||||
|
```xml
|
||||||
|
<Version>1.0.0</Version>
|
||||||
|
```
|
||||||
|
Risultato:
|
||||||
|
- `gitea.../alby96/autobidder:latest` ? v1.0.0
|
||||||
|
- `gitea.../alby96/autobidder:1.0.0` ? v1.0.0
|
||||||
|
|
||||||
|
**Scenario 2: Aggiornamento versione**
|
||||||
|
```xml
|
||||||
|
<Version>1.0.1</Version>
|
||||||
|
```
|
||||||
|
Risultato:
|
||||||
|
- `gitea.../alby96/autobidder:latest` ? **aggiornato** a v1.0.1
|
||||||
|
- `gitea.../alby96/autobidder:1.0.1` ? **nuovo tag** creato
|
||||||
|
- `gitea.../alby96/autobidder:1.0.0` ? rimane disponibile
|
||||||
|
|
||||||
|
### Best Practices
|
||||||
|
|
||||||
|
| Ambiente | Tag Consigliato | Motivo |
|
||||||
|
|----------|----------------|---------|
|
||||||
|
| **Development** | `latest` | Sempre l'ultima versione |
|
||||||
|
| **Staging** | `1.0.1` | Versione specifica per test |
|
||||||
|
| **Production** | `1.0.1` | Versione immutabile e tracciabile |
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 4. Dove Trovare le Immagini Pubblicate
|
||||||
|
|
||||||
|
### Link Diretto al Package
|
||||||
|
```
|
||||||
|
https://gitea.encke-hake.ts.net/Alby96/-/packages/container/autobidder
|
||||||
|
```
|
||||||
|
|
||||||
|
### Lista Packages Utente
|
||||||
|
```
|
||||||
|
https://gitea.encke-hake.ts.net/Alby96/-/packages
|
||||||
|
```
|
||||||
|
|
||||||
|
Su Gitea vedrai:
|
||||||
|
- ?? Nome: **`autobidder`**
|
||||||
|
- ??? Tag: `latest`, `1.0.0`, `1.0.1`, ...
|
||||||
|
- ?? Data pubblicazione
|
||||||
|
- ?? Digest SHA256
|
||||||
|
- ?? Dimensione immagine
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 5. Usare l'Immagine Pubblicata
|
||||||
|
|
||||||
|
### Pull con Versione Specifica
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Versione immutabile (CONSIGLIATO per production)
|
||||||
|
docker pull gitea.encke-hake.ts.net/alby96/autobidder:1.0.1
|
||||||
|
|
||||||
|
# Latest (sempre aggiornato)
|
||||||
|
docker pull gitea.encke-hake.ts.net/alby96/autobidder:latest
|
||||||
|
```
|
||||||
|
|
||||||
|
### Su Unraid
|
||||||
|
|
||||||
|
1. Docker tab ? **Add Container**
|
||||||
|
2. **Repository**: `gitea.encke-hake.ts.net/alby96/autobidder:1.0.1`
|
||||||
|
3. **Port**: `5000` ? `8080`
|
||||||
|
4. **Volume 1**: `/mnt/user/appdata/autobidder/data` ? `/app/Data`
|
||||||
|
5. **Volume 2**: `/mnt/user/appdata/autobidder/logs` ? `/app/logs`
|
||||||
|
6. **Environment**: `ASPNETCORE_ENVIRONMENT=Production`
|
||||||
|
7. **Restart**: `unless-stopped`
|
||||||
|
|
||||||
|
### Docker Compose
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
version: '3.8'
|
||||||
|
|
||||||
|
services:
|
||||||
|
autobidder:
|
||||||
|
image: gitea.encke-hake.ts.net/alby96/autobidder:1.0.1 # Versione specifica
|
||||||
|
container_name: autobidder
|
||||||
|
ports:
|
||||||
|
- "5000:8080"
|
||||||
|
volumes:
|
||||||
|
- ./data:/app/Data
|
||||||
|
- ./logs:/app/logs
|
||||||
|
environment:
|
||||||
|
- ASPNETCORE_ENVIRONMENT=Production
|
||||||
|
restart: unless-stopped
|
||||||
|
```
|
||||||
|
|
||||||
|
### Docker Run
|
||||||
|
|
||||||
|
```bash
|
||||||
|
docker run -d \
|
||||||
|
--name autobidder \
|
||||||
|
-p 5000:8080 \
|
||||||
|
-v /path/to/data:/app/Data \
|
||||||
|
-v /path/to/logs:/app/logs \
|
||||||
|
-e ASPNETCORE_ENVIRONMENT=Production \
|
||||||
|
--restart unless-stopped \
|
||||||
|
gitea.encke-hake.ts.net/alby96/autobidder:1.0.1
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 6. Troubleshooting
|
||||||
|
|
||||||
|
### Errore: "unauthorized: authentication required"
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Re-autentica con Token PAT
|
||||||
|
docker logout gitea.encke-hake.ts.net
|
||||||
|
docker login gitea.encke-hake.ts.net
|
||||||
|
# Username: Alby96
|
||||||
|
# Password: [TOKEN PAT]
|
||||||
|
```
|
||||||
|
|
||||||
|
### Errore: "denied: requested access to the resource is denied"
|
||||||
|
|
||||||
|
**Causa:** Token PAT senza permessi corretti o scaduto
|
||||||
|
|
||||||
|
**Soluzione:**
|
||||||
|
1. Vai su: `https://gitea.encke-hake.ts.net/user/settings/applications`
|
||||||
|
2. Verifica che il token abbia: `read:packages` + `write:packages`
|
||||||
|
3. Se scaduto, genera nuovo token
|
||||||
|
|
||||||
|
### Errore: "La compilazione non è riuscita" ma il push è riuscito
|
||||||
|
|
||||||
|
**Sintomo:**
|
||||||
|
Visual Studio mostra:
|
||||||
|
```
|
||||||
|
Errore MSB4057: la destinazione "ContainerBuild" non è presente nel progetto
|
||||||
|
```
|
||||||
|
|
||||||
|
Ma nel log vedi:
|
||||||
|
```
|
||||||
|
? Pushed: gitea.../autobidder:latest
|
||||||
|
? Pushed: gitea.../autobidder:1.0.0
|
||||||
|
```
|
||||||
|
|
||||||
|
**Causa:** Il profilo stava usando `WebPublishMethod=Docker` che richiede Microsoft.Docker.Sdk non installato.
|
||||||
|
|
||||||
|
**? RISOLTO:** Il profilo è stato corretto per usare `WebPublishMethod=Custom` che non richiede SDK aggiuntivi.
|
||||||
|
|
||||||
|
### Verifica push su Gitea
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Test manuale push
|
||||||
|
docker push gitea.encke-hake.ts.net/alby96/autobidder:latest
|
||||||
|
|
||||||
|
# Se fallisce, verifica autenticazione
|
||||||
|
docker logout gitea.encke-hake.ts.net
|
||||||
|
docker login gitea.encke-hake.ts.net
|
||||||
|
```
|
||||||
|
|
||||||
|
### Versione non cambia su Gitea
|
||||||
|
|
||||||
|
**Verifica:**
|
||||||
|
1. Hai modificato `<Version>` in `AutoBidder.csproj`?
|
||||||
|
2. Hai fatto Rebuild completo?
|
||||||
|
3. Visual Studio ha mostrato il nuovo numero versione nell'output?
|
||||||
|
|
||||||
|
**Soluzione:** Rebuild completo
|
||||||
|
```bash
|
||||||
|
# Da Visual Studio: Build ? Rebuild Solution
|
||||||
|
# Poi: Tasto destro ? Pubblica ? GiteaRegistry
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 7. Riferimenti
|
||||||
|
|
||||||
|
- **Registry URL**: `https://gitea.encke-hake.ts.net`
|
||||||
|
- **Repository Codice**: `https://gitea.encke-hake.ts.net/Alby96/Mimante`
|
||||||
|
- **Packages Container**: `https://gitea.encke-hake.ts.net/Alby96/-/packages`
|
||||||
|
- **Package Autobidder**: `https://gitea.encke-hake.ts.net/Alby96/-/packages/container/autobidder`
|
||||||
|
- **Convenzione Gitea**: `{registro}/{owner}/{image}:{tag}` (3 livelli)
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 8. Riepilogo Comandi Rapidi
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# 1. Autenticazione (prima volta)
|
||||||
|
docker login gitea.encke-hake.ts.net
|
||||||
|
|
||||||
|
# 2. Pubblica da Visual Studio
|
||||||
|
# Tasto destro ? Pubblica ? GiteaRegistry
|
||||||
|
|
||||||
|
# 3. Pull versione specifica
|
||||||
|
docker pull gitea.encke-hake.ts.net/alby96/autobidder:1.0.1
|
||||||
|
|
||||||
|
# 4. Pull latest
|
||||||
|
docker pull gitea.encke-hake.ts.net/alby96/autobidder:latest
|
||||||
|
|
||||||
|
# 5. Run container
|
||||||
|
docker run -d --name autobidder \
|
||||||
|
-p 5000:8080 \
|
||||||
|
-v /data:/app/Data \
|
||||||
|
gitea.encke-hake.ts.net/alby96/autobidder:1.0.1
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
**? CONFIGURAZIONE COMPLETATA!**
|
||||||
|
|
||||||
|
Ora hai un sistema di pubblicazione Docker con **versionamento automatico** completamente integrato! ??
|
||||||
|
|
||||||
|
## 3. Dove Trovare il Package su Gitea
|
||||||
|
|
||||||
|
**IL PACKAGE E' PUBBLICATO!** Cercalo in uno di questi percorsi:
|
||||||
|
|
||||||
|
### Percorso 1: Packages del Tuo Profilo (PRINCIPALE)
|
||||||
|
```
|
||||||
|
https://gitea.encke-hake.ts.net/Alby96/-/packages
|
||||||
|
```
|
||||||
|
Cerca un package di tipo **Container** con nome: `mimante/autobidder` oppure `mimante`
|
||||||
|
|
||||||
|
### Percorso 2: Explore Packages
|
||||||
|
```
|
||||||
|
https://gitea.encke-hake.ts.net/explore/packages
|
||||||
|
```
|
||||||
|
Filtra per tipo "Container" e cerca `mimante` o `autobidder`
|
||||||
|
|
||||||
|
### Percorso 3: Packages del Repository
|
||||||
|
```
|
||||||
|
https://gitea.encke-hake.ts.net/Alby96/Mimante/-/packages
|
||||||
|
```
|
||||||
|
|
||||||
|
### Verifica Push Riuscito
|
||||||
|
|
||||||
|
Se hai eseguito il push e vedi nell'output:
|
||||||
|
```
|
||||||
|
latest: digest: sha256:cb7621ed1f22... size: 856
|
||||||
|
```
|
||||||
|
Significa che **il package E' STATO pubblicato correttamente!**
|
||||||
|
|
||||||
|
Per verificare:
|
||||||
|
```bash
|
||||||
|
docker push gitea.encke-hake.ts.net/alby96/mimante/autobidder:latest
|
||||||
|
```
|
||||||
|
|
||||||
|
## 4. Usare l'Immagine Pubblicata
|
||||||
|
|
||||||
|
### Su Unraid
|
||||||
|
|
||||||
|
1. Vai su **Docker** tab
|
||||||
|
2. Click **Add Container**
|
||||||
|
3. **Repository**: `gitea.encke-hake.ts.net/alby96/mimante/autobidder:latest`
|
||||||
|
4. **Port**: `5000` -> `8080` (container)
|
||||||
|
5. **Volume**: `/mnt/user/appdata/autobidder/data` -> `/app/Data`
|
||||||
|
6. **Volume**: `/mnt/user/appdata/autobidder/logs` -> `/app/logs`
|
||||||
|
7. **Environment**: `ASPNETCORE_ENVIRONMENT=Production`
|
||||||
|
|
||||||
|
### Docker Compose
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
version: '3.8'
|
||||||
|
|
||||||
|
services:
|
||||||
|
autobidder:
|
||||||
|
image: gitea.encke-hake.ts.net/alby96/autobidder:latest
|
||||||
|
container_name: autobidder
|
||||||
|
ports:
|
||||||
|
- "5000:8080"
|
||||||
|
volumes:
|
||||||
|
- ./data:/app/Data
|
||||||
|
- ./logs:/app/logs
|
||||||
|
environment:
|
||||||
|
- ASPNETCORE_ENVIRONMENT=Production
|
||||||
|
restart: unless-stopped
|
||||||
|
```
|
||||||
|
|
||||||
|
### Docker Run
|
||||||
|
|
||||||
|
```bash
|
||||||
|
docker pull gitea.encke-hake.ts.net/alby96/mimante/autobidder:latest
|
||||||
|
|
||||||
|
docker run -d --name autobidder -p 5000:8080 -v /path/to/data:/app/Data -v /path/to/logs:/app/logs -e ASPNETCORE_ENVIRONMENT=Production gitea.encke-hake.ts.net/alby96/mimante/autobidder:latest
|
||||||
|
```
|
||||||
|
|
||||||
|
## 5. Aggiornare la Versione
|
||||||
|
|
||||||
|
1. Apri `AutoBidder.csproj`
|
||||||
|
2. Modifica il tag `<Version>`:
|
||||||
|
```xml
|
||||||
|
<Version>1.0.1</Version>
|
||||||
|
```
|
||||||
|
3. Pubblica:
|
||||||
|
```bash
|
||||||
|
dotnet publish /p:PublishProfile=GiteaRegistry
|
||||||
|
```
|
||||||
|
|
||||||
|
## Troubleshooting
|
||||||
|
|
||||||
|
### Errore: "unauthorized: authentication required"
|
||||||
|
|
||||||
|
```bash
|
||||||
|
docker login gitea.encke-hake.ts.net
|
||||||
|
```
|
||||||
|
|
||||||
|
### Package non visibile su Gitea
|
||||||
|
|
||||||
|
**Il package c'e'!** Controlla in:
|
||||||
|
- `https://gitea.encke-hake.ts.net/Alby96/-/packages` (packages utente)
|
||||||
|
- `https://gitea.encke-hake.ts.net/explore/packages` (tutti)
|
||||||
|
|
||||||
|
Cerca per nome: `mimante`, `autobidder`, o `mimante/autobidder` (tipo: Container)
|
||||||
|
|
||||||
|
Se vedi `digest: sha256:...` nel push, il package E' pubblicato.
|
||||||
|
|
||||||
|
## Riferimenti
|
||||||
|
|
||||||
|
- **Registry**: `https://gitea.encke-hake.ts.net`
|
||||||
|
- **Repository**: `https://gitea.encke-hake.ts.net/Alby96/Mimante`
|
||||||
|
- **Packages**: `https://gitea.encke-hake.ts.net/Alby96/-/packages` ?
|
||||||
|
- **Package Diretto**: `https://gitea.encke-hake.ts.net/Alby96/-/packages/container/mimante%2Fautobidder/latest`
|
||||||
|
- **Immagine**: `gitea.encke-hake.ts.net/alby96/mimante/autobidder`
|
||||||
|
|
||||||
|
## Comandi Rapidi
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# 1. Login
|
||||||
|
docker login gitea.encke-hake.ts.net
|
||||||
|
|
||||||
|
# 2. Build e push
|
||||||
|
dotnet publish /p:PublishProfile=GiteaRegistry
|
||||||
|
|
||||||
|
# 3. Pull
|
||||||
|
docker pull gitea.encke-hake.ts.net/alby96/mimante/autobidder:latest
|
||||||
|
|
||||||
|
# 4. Run
|
||||||
|
docker run -d --name autobidder -p 5000:8080 -v /data:/app/Data gitea.encke-hake.ts.net/alby96/mimante/autobidder:latest
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
**Il package E' stato pubblicato!** Verifica su: `https://gitea.encke-hake.ts.net/Alby96/-/packages`
|
||||||
250
Mimante/NUOVO_WORKFLOW_RIEPILOGO.md
Normal file
250
Mimante/NUOVO_WORKFLOW_RIEPILOGO.md
Normal file
@@ -0,0 +1,250 @@
|
|||||||
|
# ?? Nuovo Workflow Docker + Gitea - RIEPILOGO
|
||||||
|
|
||||||
|
## ? Cosa è Cambiato
|
||||||
|
|
||||||
|
### PRIMA (Approccio Custom)
|
||||||
|
- Profili `.pubxml` con comandi Docker custom
|
||||||
|
- Non compatibili con GUI Visual Studio
|
||||||
|
- Richiedeva comandi manuali da terminale
|
||||||
|
|
||||||
|
### DOPO (Approccio Nativo Visual Studio)
|
||||||
|
- Profili `.pubxml` standard Docker di Visual Studio
|
||||||
|
- **Funziona dalla GUI** (Tasto destro ? Pubblica)
|
||||||
|
- Post-build target automatico nel `.csproj`
|
||||||
|
- Workflow completamente integrato
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## ?? Workflow Completo
|
||||||
|
|
||||||
|
```
|
||||||
|
???????????????????????????????????????????????????
|
||||||
|
? Visual Studio ? Tasto Destro ? Pubblica ?
|
||||||
|
? Seleziona profilo: GiteaRegistry ?
|
||||||
|
???????????????????????????????????????????????????
|
||||||
|
?
|
||||||
|
?
|
||||||
|
???????????????????????????????????????????????????
|
||||||
|
? 1. Build .NET (Release) ?
|
||||||
|
???????????????????????????????????????????????????
|
||||||
|
?
|
||||||
|
?
|
||||||
|
???????????????????????????????????????????????????
|
||||||
|
? 2. Docker build ?
|
||||||
|
? docker build -t autobidder:latest . ?
|
||||||
|
???????????????????????????????????????????????????
|
||||||
|
?
|
||||||
|
?
|
||||||
|
???????????????????????????????????????????????????
|
||||||
|
? 3. POST-BUILD TARGET (AutoBidder.csproj) ?
|
||||||
|
? - Tag: autobidder:latest ?
|
||||||
|
? ? gitea.../alby96/autobidder:latest ?
|
||||||
|
? - Tag: autobidder:latest ?
|
||||||
|
? ? gitea.../alby96/autobidder:1.0.0 ?
|
||||||
|
???????????????????????????????????????????????????
|
||||||
|
?
|
||||||
|
?
|
||||||
|
???????????????????????????????????????????????????
|
||||||
|
? 4. Push su Gitea ?
|
||||||
|
? - docker push .../autobidder:latest ?
|
||||||
|
? - docker push .../autobidder:1.0.0 ?
|
||||||
|
???????????????????????????????????????????????????
|
||||||
|
?
|
||||||
|
?
|
||||||
|
???????????????????????????????????????????????????
|
||||||
|
? ? PUBBLICATO SU GITEA ?
|
||||||
|
? https://gitea.../Alby96/-/packages ?
|
||||||
|
???????????????????????????????????????????????????
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## ?? File Modificati
|
||||||
|
|
||||||
|
### 1. `AutoBidder.csproj`
|
||||||
|
|
||||||
|
**Aggiunto:**
|
||||||
|
```xml
|
||||||
|
<!-- POST-BUILD TARGET: Push automatico su Gitea -->
|
||||||
|
<Target Name="PushDockerImageToGitea" AfterTargets="Publish" Condition="'$(PushToGiteaRegistry)' == 'true'">
|
||||||
|
<!-- Tag e push automatico su gitea.encke-hake.ts.net/alby96/autobidder -->
|
||||||
|
</Target>
|
||||||
|
```
|
||||||
|
|
||||||
|
### 2. `Properties/PublishProfiles/GiteaRegistry.pubxml` (NUOVO)
|
||||||
|
|
||||||
|
```xml
|
||||||
|
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
|
<PropertyGroup>
|
||||||
|
<WebPublishMethod>Docker</WebPublishMethod>
|
||||||
|
<DockerPublish>true</DockerPublish>
|
||||||
|
<PublishProvider>DockerContainer</PublishProvider>
|
||||||
|
|
||||||
|
<DockerfileTag>autobidder:latest</DockerfileTag>
|
||||||
|
<PushToGiteaRegistry>true</PushToGiteaRegistry> <!-- Abilita push -->
|
||||||
|
</PropertyGroup>
|
||||||
|
</Project>
|
||||||
|
```
|
||||||
|
|
||||||
|
**Cosa fa:**
|
||||||
|
- Build Docker dell'immagine locale
|
||||||
|
- Attiva post-build target per push su Gitea
|
||||||
|
- **Funziona da GUI Visual Studio** ?
|
||||||
|
|
||||||
|
### 3. `Properties/PublishProfiles/GiteaRegistry-LocalOnly.pubxml` (NUOVO)
|
||||||
|
|
||||||
|
```xml
|
||||||
|
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
|
<PropertyGroup>
|
||||||
|
<WebPublishMethod>Docker</WebPublishMethod>
|
||||||
|
<DockerPublish>true</DockerPublish>
|
||||||
|
<PublishProvider>DockerContainer</PublishProvider>
|
||||||
|
|
||||||
|
<DockerfileTag>autobidder:latest</DockerfileTag>
|
||||||
|
<PushToGiteaRegistry>false</PushToGiteaRegistry> <!-- NO push -->
|
||||||
|
</PropertyGroup>
|
||||||
|
</Project>
|
||||||
|
```
|
||||||
|
|
||||||
|
**Cosa fa:**
|
||||||
|
- Build Docker solo locale
|
||||||
|
- NESSUN push su Gitea
|
||||||
|
- Utile per test
|
||||||
|
|
||||||
|
### 4. `DOCKER_PUBLISH_GUIDE.md` (AGGIORNATA)
|
||||||
|
|
||||||
|
- Istruzioni per uso da Visual Studio GUI
|
||||||
|
- Workflow completo documentato
|
||||||
|
- Troubleshooting aggiornato
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## ?? Come Usare
|
||||||
|
|
||||||
|
### Opzione 1: Da Visual Studio (CONSIGLIATO)
|
||||||
|
|
||||||
|
1. **Tasto destro** sul progetto `AutoBidder`
|
||||||
|
2. Click **Pubblica**
|
||||||
|
3. Seleziona profilo: **`GiteaRegistry`**
|
||||||
|
4. Click **Pubblica**
|
||||||
|
|
||||||
|
? **FATTO!** L'immagine viene buildat?, taggata e pubblicata automaticamente.
|
||||||
|
|
||||||
|
### Opzione 2: Da Riga di Comando
|
||||||
|
|
||||||
|
```bash
|
||||||
|
dotnet publish -c Release /p:PublishProfile=GiteaRegistry
|
||||||
|
```
|
||||||
|
|
||||||
|
### Opzione 3: Solo Build Locale (Test)
|
||||||
|
|
||||||
|
```bash
|
||||||
|
dotnet publish -c Release /p:PublishProfile=GiteaRegistry-LocalOnly
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## ?? Prerequisito: Autenticazione
|
||||||
|
|
||||||
|
**Prima volta (OBBLIGATORIO):**
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# 1. Genera Token PAT su Gitea
|
||||||
|
# https://gitea.encke-hake.ts.net/user/settings/applications
|
||||||
|
# Scope: read:packages + write:packages
|
||||||
|
|
||||||
|
# 2. Autentica Docker
|
||||||
|
docker login gitea.encke-hake.ts.net
|
||||||
|
# Username: Alby96
|
||||||
|
# Password: [TOKEN PAT]
|
||||||
|
```
|
||||||
|
|
||||||
|
**NOTA:** Se hai 2FA su Gitea, il Token PAT è **OBBLIGATORIO**.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## ? Vantaggi del Nuovo Approccio
|
||||||
|
|
||||||
|
| Aspetto | Prima (Custom) | Dopo (Nativo VS) |
|
||||||
|
|---------|----------------|------------------|
|
||||||
|
| **GUI Visual Studio** | ? Non funzionava | ? Funziona perfettamente |
|
||||||
|
| **Semplicità** | Comandi manuali | Click ? Pubblica |
|
||||||
|
| **Standard** | Approccio custom | Standard Microsoft |
|
||||||
|
| **Manutenibilità** | Complesso | Semplice |
|
||||||
|
| **Errori** | Difficili da debuggare | Output chiaro |
|
||||||
|
| **Workflow** | Multi-step manuale | Automatico end-to-end |
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## ?? Verifica Post-Pubblicazione
|
||||||
|
|
||||||
|
Dopo la pubblicazione, Visual Studio mostrerà:
|
||||||
|
|
||||||
|
```
|
||||||
|
========================================
|
||||||
|
POST-BUILD: Tagging and pushing to Gitea Registry
|
||||||
|
========================================
|
||||||
|
Tagged: gitea.encke-hake.ts.net/alby96/autobidder:latest
|
||||||
|
Tagged: gitea.encke-hake.ts.net/alby96/autobidder:1.0.0
|
||||||
|
========================================
|
||||||
|
Pushing to Gitea Registry...
|
||||||
|
========================================
|
||||||
|
Pushed: gitea.encke-hake.ts.net/alby96/autobidder:latest
|
||||||
|
Pushed: gitea.encke-hake.ts.net/alby96/autobidder:1.0.0
|
||||||
|
========================================
|
||||||
|
SUCCESS: Images published to Gitea!
|
||||||
|
========================================
|
||||||
|
View on Gitea:
|
||||||
|
https://gitea.encke-hake.ts.net/Alby96/-/packages/container/autobidder/latest
|
||||||
|
========================================
|
||||||
|
```
|
||||||
|
|
||||||
|
**Verifica su Gitea:**
|
||||||
|
- Vai su: `https://gitea.encke-hake.ts.net/Alby96/-/packages`
|
||||||
|
- Cerca package: `autobidder` (tipo: Container)
|
||||||
|
- Verifica tag: `latest` e `1.0.0`
|
||||||
|
- Controlla data: dovrebbe essere oggi
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## ?? Prossimi Passi
|
||||||
|
|
||||||
|
1. ? Autenticati con Docker (Token PAT)
|
||||||
|
2. ? Prova pubblicazione: Tasto destro ? Pubblica ? GiteaRegistry
|
||||||
|
3. ? Verifica su Gitea che l'immagine sia caricata
|
||||||
|
4. ? Deploy su Unraid/altro server
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## ?? Note Importanti
|
||||||
|
|
||||||
|
### Convenzione Nomi Gitea (CORRETTA)
|
||||||
|
|
||||||
|
```
|
||||||
|
gitea.encke-hake.ts.net/alby96/autobidder:latest
|
||||||
|
??????????????????????? ?????? ???????????
|
||||||
|
registro owner immagine
|
||||||
|
|
||||||
|
? 3 LIVELLI (corretto)
|
||||||
|
? Non usare: /alby96/mimante/autobidder (4 livelli - ERRATO)
|
||||||
|
```
|
||||||
|
|
||||||
|
### Post-Build Condition
|
||||||
|
|
||||||
|
Il post-build target si attiva **SOLO** se:
|
||||||
|
- Profilo ha `<PushToGiteaRegistry>true</PushToGiteaRegistry>`
|
||||||
|
- `GiteaRegistry.pubxml` ? Push attivato ?
|
||||||
|
- `GiteaRegistry-LocalOnly.pubxml` ? Push disabilitato ?
|
||||||
|
|
||||||
|
### Aggiornamento Versione
|
||||||
|
|
||||||
|
Per pubblicare nuova versione:
|
||||||
|
1. Modifica `<Version>1.0.1</Version>` in `AutoBidder.csproj`
|
||||||
|
2. Pubblica normalmente
|
||||||
|
3. Vengono creati tag: `latest` (aggiornato) + `1.0.1` (nuovo)
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
**? CONFIGURAZIONE COMPLETATA!**
|
||||||
|
|
||||||
|
Ora hai un workflow professionale integrato con Visual Studio per pubblicare su Gitea! ??
|
||||||
214
Mimante/PROBLEMA_RISOLTO.md
Normal file
214
Mimante/PROBLEMA_RISOLTO.md
Normal file
@@ -0,0 +1,214 @@
|
|||||||
|
# ?? PROBLEMA RISOLTO: Errore Visual Studio con Push Riuscito
|
||||||
|
|
||||||
|
## ?? Analisi del Problema
|
||||||
|
|
||||||
|
### ? Cosa Funzionava
|
||||||
|
|
||||||
|
Dal log di pubblicazione:
|
||||||
|
```
|
||||||
|
? Tagged: gitea.encke-hake.ts.net/alby96/autobidder:latest
|
||||||
|
? Tagged: gitea.encke-hake.ts.net/alby96/autobidder:1.0.0
|
||||||
|
|
||||||
|
docker push gitea.encke-hake.ts.net/alby96/autobidder:latest
|
||||||
|
...
|
||||||
|
latest: digest: sha256:dc08591c525e29d881f65effbc569a1c4c75d7d43614d75231e9c8035e3865b0 size: 856
|
||||||
|
? Pushed: gitea.encke-hake.ts.net/alby96/autobidder:latest
|
||||||
|
|
||||||
|
docker push gitea.encke-hake.ts.net/alby96/autobidder:1.0.0
|
||||||
|
...
|
||||||
|
1.0.0: digest: sha256:dc08591c525e29d881f65effbc569a1c4c75d7d43614d75231e9c8035e3865b0 size: 856
|
||||||
|
? Pushed: gitea.encke-hake.ts.net/alby96/autobidder:1.0.0
|
||||||
|
|
||||||
|
?????????????????????????????????????????????????????????????????????
|
||||||
|
? ? PUBBLICAZIONE COMPLETATA CON SUCCESSO! ?
|
||||||
|
?????????????????????????????????????????????????????????????????????
|
||||||
|
```
|
||||||
|
|
||||||
|
**Tutto perfetto**: Build, tag e push su Gitea funzionanti al 100%!
|
||||||
|
|
||||||
|
### ? Errore Visual Studio
|
||||||
|
|
||||||
|
Alla fine del processo:
|
||||||
|
```
|
||||||
|
1>La compilazione non è riuscita. Vedere la finestra di output per altre informazioni.
|
||||||
|
========== Pubblicazione: 0 completato/i, 1 non riuscito/i, 0 ignorato/i ==========
|
||||||
|
|
||||||
|
Errore MSB4057: la destinazione "ContainerBuild" non è presente nel progetto.
|
||||||
|
C:\Program Files\Microsoft Visual Studio\18\Community\MSBuild\Sdks\Microsoft.Docker.Sdk\build\Microsoft.Docker.targets(173,5)
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## ?? Causa del Problema
|
||||||
|
|
||||||
|
### Configurazione Precedente (ERRATA)
|
||||||
|
|
||||||
|
**File:** `Properties/PublishProfiles/GiteaRegistry.pubxml`
|
||||||
|
|
||||||
|
```xml
|
||||||
|
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
|
<PropertyGroup>
|
||||||
|
<!-- ? PROBLEMA: Usa Docker SDK di Visual Studio -->
|
||||||
|
<WebPublishMethod>Docker</WebPublishMethod>
|
||||||
|
<DockerPublish>true</DockerPublish>
|
||||||
|
<PublishProvider>DockerContainer</PublishProvider>
|
||||||
|
<_TargetId>Docker</_TargetId>
|
||||||
|
|
||||||
|
<DockerfileTag>autobidder:latest</DockerfileTag>
|
||||||
|
<PushToGiteaRegistry>true</PushToGiteaRegistry>
|
||||||
|
</PropertyGroup>
|
||||||
|
</Project>
|
||||||
|
```
|
||||||
|
|
||||||
|
**Problema:**
|
||||||
|
- `<WebPublishMethod>Docker</WebPublishMethod>` richiede **Microsoft.Docker.Sdk**
|
||||||
|
- Visual Studio cerca il target `ContainerBuild` nel progetto
|
||||||
|
- Il target non esiste perché l'SDK non è installato (e non serve!)
|
||||||
|
- Visual Studio fallisce DOPO che il nostro workflow custom ha già pubblicato con successo
|
||||||
|
|
||||||
|
### Flusso Esecuzione
|
||||||
|
|
||||||
|
```
|
||||||
|
1. ? Build .NET (Release)
|
||||||
|
2. ? Publish files ? obj\Docker\publish
|
||||||
|
3. ? Post-build target "PushDockerImageToGitea" (dal .csproj)
|
||||||
|
?? ? docker build
|
||||||
|
?? ? docker tag
|
||||||
|
?? ? docker push (SUCCESSO!)
|
||||||
|
4. ? Visual Studio cerca target "ContainerBuild" (Docker SDK)
|
||||||
|
5. ? Target non trovato ? ERRORE (ma push già fatto!)
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## ? Soluzione Implementata
|
||||||
|
|
||||||
|
### Nuova Configurazione (CORRETTA)
|
||||||
|
|
||||||
|
**File:** `Properties/PublishProfiles/GiteaRegistry.pubxml`
|
||||||
|
|
||||||
|
```xml
|
||||||
|
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
|
<PropertyGroup>
|
||||||
|
<!-- ? CORRETTO: Usa Custom senza Docker SDK -->
|
||||||
|
<WebPublishMethod>Custom</WebPublishMethod>
|
||||||
|
<PublishProvider>FileSystem</PublishProvider>
|
||||||
|
<LastUsedBuildConfiguration>Release</LastUsedBuildConfiguration>
|
||||||
|
<LastUsedPlatform>Any CPU</LastUsedPlatform>
|
||||||
|
|
||||||
|
<!-- Path pubblicazione temporanea -->
|
||||||
|
<PublishUrl>obj\Docker\publish</PublishUrl>
|
||||||
|
<DeleteExistingFiles>True</DeleteExistingFiles>
|
||||||
|
|
||||||
|
<!-- Configurazione Docker -->
|
||||||
|
<DockerfileTag>autobidder:latest</DockerfileTag>
|
||||||
|
<DockerfilePath>$(MSBuildProjectDirectory)\Dockerfile</DockerfilePath>
|
||||||
|
<DockerfileContext>$(MSBuildProjectDirectory)</DockerfileContext>
|
||||||
|
|
||||||
|
<!-- Abilita post-build Gitea -->
|
||||||
|
<PushToGiteaRegistry>true</PushToGiteaRegistry>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<!-- Target Docker Build custom -->
|
||||||
|
<Target Name="DockerBuild" AfterTargets="GatherAllFilesToPublish">
|
||||||
|
<Message Importance="high" Text="?? Building Docker image..." />
|
||||||
|
<Exec Command="docker build -t $(DockerfileTag) -f "$(DockerfilePath)" "$(DockerfileContext)"" />
|
||||||
|
<Message Importance="high" Text="? Docker build completed!" />
|
||||||
|
</Target>
|
||||||
|
</Project>
|
||||||
|
```
|
||||||
|
|
||||||
|
**Vantaggi:**
|
||||||
|
- ? Non richiede Microsoft.Docker.Sdk
|
||||||
|
- ? Visual Studio non cerca target mancanti
|
||||||
|
- ? Controllo completo del workflow
|
||||||
|
- ? Nessun errore alla fine del processo
|
||||||
|
|
||||||
|
### Nuovo Flusso Esecuzione
|
||||||
|
|
||||||
|
```
|
||||||
|
1. ? Build .NET (Release)
|
||||||
|
2. ? Publish files ? obj\Docker\publish
|
||||||
|
3. ? Target "DockerBuild" (dal profilo .pubxml)
|
||||||
|
?? docker build -t autobidder:latest
|
||||||
|
4. ? Post-build target "PushDockerImageToGitea" (dal .csproj)
|
||||||
|
?? docker tag ? gitea.../autobidder:latest
|
||||||
|
?? docker tag ? gitea.../autobidder:1.0.0
|
||||||
|
?? docker push latest
|
||||||
|
?? docker push 1.0.0
|
||||||
|
5. ? Visual Studio: SUCCESS! ?
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## ?? Confronto Prima/Dopo
|
||||||
|
|
||||||
|
| Aspetto | Prima (Docker SDK) | Dopo (Custom) |
|
||||||
|
|---------|-------------------|---------------|
|
||||||
|
| **WebPublishMethod** | `Docker` | `Custom` |
|
||||||
|
| **Richiede SDK** | ? Sì (non installato) | ? No |
|
||||||
|
| **Docker Build** | Post-build .csproj | Target .pubxml + Post-build |
|
||||||
|
| **Errore finale** | ? Sì (target mancante) | ? No |
|
||||||
|
| **Push funziona** | ? Sì | ? Sì |
|
||||||
|
| **Visual Studio OK** | ? No (errore) | ? Sì |
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## ?? Risultato Finale
|
||||||
|
|
||||||
|
### Output Pubblicazione Corretta
|
||||||
|
|
||||||
|
```
|
||||||
|
?????????????????????????????????????????????????????????????????????
|
||||||
|
? DOCKER BUILD: Building container image ?
|
||||||
|
?????????????????????????????????????????????????????????????????????
|
||||||
|
|
||||||
|
?? Building: autobidder:latest
|
||||||
|
? Docker build completed successfully!
|
||||||
|
|
||||||
|
?????????????????????????????????????????????????????????????????????
|
||||||
|
? POST-BUILD: Pubblicazione su Gitea Container Registry ?
|
||||||
|
?????????????????????????????????????????????????????????????????????
|
||||||
|
|
||||||
|
?? Solution Version: 1.0.0
|
||||||
|
??? Target Tags:
|
||||||
|
• gitea.encke-hake.ts.net/alby96/autobidder:latest
|
||||||
|
• gitea.encke-hake.ts.net/alby96/autobidder:1.0.0
|
||||||
|
|
||||||
|
? Tagged: gitea.encke-hake.ts.net/alby96/autobidder:latest
|
||||||
|
? Tagged: gitea.encke-hake.ts.net/alby96/autobidder:1.0.0
|
||||||
|
? Pushed: gitea.encke-hake.ts.net/alby96/autobidder:latest
|
||||||
|
? Pushed: gitea.encke-hake.ts.net/alby96/autobidder:1.0.0
|
||||||
|
|
||||||
|
?????????????????????????????????????????????????????????????????????
|
||||||
|
? ? PUBBLICAZIONE COMPLETATA CON SUCCESSO! ?
|
||||||
|
?????????????????????????????????????????????????????????????????????
|
||||||
|
|
||||||
|
========== Pubblicazione: 1 completato/i, 0 non riuscito/i, 0 ignorato/i ==========
|
||||||
|
```
|
||||||
|
|
||||||
|
**Visual Studio mostra SUCCESS senza errori!** ?
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## ?? Lezioni Apprese
|
||||||
|
|
||||||
|
1. **`WebPublishMethod=Docker`** richiede Microsoft.Docker.Sdk installato
|
||||||
|
2. **`WebPublishMethod=Custom`** permette workflow personalizzati senza SDK
|
||||||
|
3. Il nostro workflow custom funzionava già (push riuscito), ma Visual Studio non era soddisfatto
|
||||||
|
4. Separare build Docker (target nel .pubxml) da push Gitea (target nel .csproj) rende il processo più chiaro
|
||||||
|
5. Visual Studio può mostrare errori anche se l'operazione è riuscita (cerca target che non trova)
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## ? Checklist Verifica
|
||||||
|
|
||||||
|
- [x] Build .NET funziona
|
||||||
|
- [x] Docker build funziona
|
||||||
|
- [x] Tag Gitea creati
|
||||||
|
- [x] Push su Gitea riuscito
|
||||||
|
- [x] Visual Studio non mostra errori
|
||||||
|
- [x] Digest SHA256 visibile su Gitea
|
||||||
|
- [x] Immagini disponibili per pull
|
||||||
|
|
||||||
|
**TUTTO FUNZIONANTE!** ??
|
||||||
@@ -8,14 +8,49 @@ using System.Data.Common;
|
|||||||
|
|
||||||
var builder = WebApplication.CreateBuilder(args);
|
var builder = WebApplication.CreateBuilder(args);
|
||||||
|
|
||||||
// Configura Kestrel per accesso remoto con supporto HTTPS
|
// Configura Kestrel per accesso remoto
|
||||||
|
// HTTPS è abilitato solo se esplicitamente configurato o in ambiente Development
|
||||||
|
var enableHttps = builder.Configuration.GetValue<bool>("Kestrel:EnableHttps", builder.Environment.IsDevelopment());
|
||||||
|
|
||||||
builder.WebHost.ConfigureKestrel(options =>
|
builder.WebHost.ConfigureKestrel(options =>
|
||||||
{
|
{
|
||||||
options.ListenAnyIP(5000); // HTTP
|
options.ListenAnyIP(5000); // HTTP
|
||||||
options.ListenAnyIP(5001, listenOptions =>
|
|
||||||
|
if (enableHttps)
|
||||||
{
|
{
|
||||||
listenOptions.UseHttps(); // HTTPS
|
try
|
||||||
});
|
{
|
||||||
|
options.ListenAnyIP(5001, listenOptions =>
|
||||||
|
{
|
||||||
|
// In produzione, cerca il certificato da configurazione
|
||||||
|
var certPath = builder.Configuration["Kestrel:Certificates:Default:Path"];
|
||||||
|
var certPassword = builder.Configuration["Kestrel:Certificates:Default:Password"];
|
||||||
|
|
||||||
|
if (!string.IsNullOrEmpty(certPath) && File.Exists(certPath))
|
||||||
|
{
|
||||||
|
listenOptions.UseHttps(certPath, certPassword);
|
||||||
|
Console.WriteLine($"[Kestrel] HTTPS enabled with certificate: {certPath}");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Usa certificato di sviluppo (solo in Development)
|
||||||
|
listenOptions.UseHttps();
|
||||||
|
Console.WriteLine("[Kestrel] HTTPS enabled with development certificate");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Console.WriteLine($"[Kestrel] Failed to enable HTTPS: {ex.Message}");
|
||||||
|
Console.WriteLine("[Kestrel] Running in HTTP-only mode");
|
||||||
|
enableHttps = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Console.WriteLine("[Kestrel] HTTPS disabled - running in HTTP-only mode");
|
||||||
|
Console.WriteLine("[Kestrel] Use a reverse proxy (nginx/traefik) for SSL termination");
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// Add services to the container
|
// Add services to the container
|
||||||
@@ -424,14 +459,24 @@ using (var scope = app.Services.CreateScope())
|
|||||||
if (!app.Environment.IsDevelopment())
|
if (!app.Environment.IsDevelopment())
|
||||||
{
|
{
|
||||||
app.UseExceptionHandler("/Error");
|
app.UseExceptionHandler("/Error");
|
||||||
app.UseHsts();
|
|
||||||
|
// Abilita HSTS solo se HTTPS è attivo
|
||||||
|
if (enableHttps)
|
||||||
|
{
|
||||||
|
app.UseHsts();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
app.UseDeveloperExceptionPage();
|
app.UseDeveloperExceptionPage();
|
||||||
}
|
}
|
||||||
|
|
||||||
app.UseHttpsRedirection();
|
// Abilita HTTPS redirection solo se HTTPS è configurato
|
||||||
|
if (enableHttps)
|
||||||
|
{
|
||||||
|
app.UseHttpsRedirection();
|
||||||
|
}
|
||||||
|
|
||||||
app.UseStaticFiles();
|
app.UseStaticFiles();
|
||||||
app.UseRouting();
|
app.UseRouting();
|
||||||
|
|
||||||
|
|||||||
183
Mimante/VERIFICA_CONFIGURAZIONE_GITEA.md
Normal file
183
Mimante/VERIFICA_CONFIGURAZIONE_GITEA.md
Normal file
@@ -0,0 +1,183 @@
|
|||||||
|
# ? Verifica Configurazione Docker + Gitea (2026)
|
||||||
|
|
||||||
|
## ?? Checklist Completa secondo Guida Gitea
|
||||||
|
|
||||||
|
### ? 1. Preparazione su Gitea
|
||||||
|
|
||||||
|
| Requisito | Stato | Dettagli |
|
||||||
|
|-----------|-------|----------|
|
||||||
|
| Container Registry abilitato | ? CONFERMATO | Package esistente su `https://gitea.encke-hake.ts.net/Alby96/-/packages` |
|
||||||
|
| Token PAT generato | ?? DA VERIFICARE | Deve avere permessi `read:packages` + `write:packages` |
|
||||||
|
| Token usato per login | ?? DA FARE | `docker login gitea.encke-hake.ts.net` con Token come password |
|
||||||
|
|
||||||
|
**?? AZIONE RICHIESTA:**
|
||||||
|
```bash
|
||||||
|
# Genera token su: https://gitea.encke-hake.ts.net/user/settings/applications
|
||||||
|
# Scope necessari: read:packages, write:packages
|
||||||
|
|
||||||
|
# Poi autentica Docker:
|
||||||
|
docker login gitea.encke-hake.ts.net
|
||||||
|
# Username: Alby96
|
||||||
|
# Password: [TOKEN_PAT_GENERATO]
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### ? 2. Configurazione Progetto Visual Studio
|
||||||
|
|
||||||
|
| Requisito | Stato | Dettagli |
|
||||||
|
|-----------|-------|----------|
|
||||||
|
| Supporto Docker abilitato | ? OK | `DockerDefaultTargetOS=Linux`, `DockerfileFile=Dockerfile` |
|
||||||
|
| Dockerfile presente | ? OK | Valido, espone porta 8080, healthcheck configurato |
|
||||||
|
| .dockerignore presente | ? OK | Esclude file non necessari |
|
||||||
|
| Profili pubblicazione | ? OK | `GiteaRegistry.pubxml` e `GiteaRegistry-Versioned.pubxml` |
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### ?? 3. Convenzione Nomi Docker (CORRETTO)
|
||||||
|
|
||||||
|
**? PROBLEMA RILEVATO E CORRETTO:**
|
||||||
|
|
||||||
|
**Prima (ERRATO - 4 livelli):**
|
||||||
|
```
|
||||||
|
gitea.encke-hake.ts.net/alby96/mimante/autobidder:latest
|
||||||
|
??????????????????????? ?????? ??????? ???????????
|
||||||
|
registro owner ??? ??? immagine
|
||||||
|
```
|
||||||
|
|
||||||
|
**Dopo correzione (CORRETTO - 3 livelli):**
|
||||||
|
```
|
||||||
|
gitea.encke-hake.ts.net/alby96/autobidder:latest
|
||||||
|
??????????????????????? ?????? ???????????
|
||||||
|
registro owner immagine
|
||||||
|
```
|
||||||
|
|
||||||
|
**?? Convenzione Gitea ufficiale:**
|
||||||
|
```
|
||||||
|
Sintassi: {registro}/{proprietario}/{immagine}:{tag}
|
||||||
|
Esempio: gitea.example.com/mio-utente/mia-app:latest
|
||||||
|
```
|
||||||
|
|
||||||
|
**? MODIFICHE APPLICATE:**
|
||||||
|
- `AutoBidder.csproj`: `<ContainerRegistry>gitea.encke-hake.ts.net/alby96</ContainerRegistry>`
|
||||||
|
- `GiteaRegistry.pubxml`: Aggiornato con path corretto
|
||||||
|
- `DOCKER_PUBLISH_GUIDE.md`: Tutti i comandi aggiornati
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### ? 4. File Modificati
|
||||||
|
|
||||||
|
#### `AutoBidder.csproj`
|
||||||
|
```xml
|
||||||
|
<!-- Metadata immagine Docker -->
|
||||||
|
<ContainerImageName>autobidder</ContainerImageName>
|
||||||
|
<ContainerImageTag>$(Version)</ContainerImageTag>
|
||||||
|
<!-- CORRETTO: Convenzione Gitea {registro}/{proprietario}/{immagine} -->
|
||||||
|
<ContainerRegistry>gitea.encke-hake.ts.net/alby96</ContainerRegistry>
|
||||||
|
```
|
||||||
|
|
||||||
|
#### `Properties/PublishProfiles/GiteaRegistry.pubxml`
|
||||||
|
```xml
|
||||||
|
<!-- CORRETTO: {registro}/{proprietario} senza livelli extra -->
|
||||||
|
<ContainerRegistry>gitea.encke-hake.ts.net/alby96</ContainerRegistry>
|
||||||
|
<ContainerImageName>autobidder</ContainerImageName>
|
||||||
|
```
|
||||||
|
|
||||||
|
#### `Dockerfile`
|
||||||
|
? **Nessuna modifica necessaria** - Il Dockerfile è corretto:
|
||||||
|
- Build multi-stage (sdk ? publish ? runtime)
|
||||||
|
- Porta 8080 esposta
|
||||||
|
- Healthcheck configurato
|
||||||
|
- Labels OCI
|
||||||
|
- Variabili ambiente corrette
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## ?? Procedura di Test
|
||||||
|
|
||||||
|
### 1. Autenticazione
|
||||||
|
```bash
|
||||||
|
docker logout gitea.encke-hake.ts.net
|
||||||
|
docker login gitea.encke-hake.ts.net
|
||||||
|
# Username: Alby96
|
||||||
|
# Password: [TOKEN_PAT]
|
||||||
|
```
|
||||||
|
|
||||||
|
### 2. Build con Convenzione Corretta
|
||||||
|
```bash
|
||||||
|
# Rebuild completo senza cache
|
||||||
|
docker build --no-cache \
|
||||||
|
-t gitea.encke-hake.ts.net/alby96/autobidder:latest \
|
||||||
|
-t gitea.encke-hake.ts.net/alby96/autobidder:1.0.0 \
|
||||||
|
.
|
||||||
|
```
|
||||||
|
|
||||||
|
### 3. Push su Gitea
|
||||||
|
```bash
|
||||||
|
docker push gitea.encke-hake.ts.net/alby96/autobidder:latest
|
||||||
|
docker push gitea.encke-hake.ts.net/alby96/autobidder:1.0.0
|
||||||
|
```
|
||||||
|
|
||||||
|
### 4. Verifica su Gitea
|
||||||
|
```
|
||||||
|
https://gitea.encke-hake.ts.net/Alby96/-/packages/container/autobidder/latest
|
||||||
|
```
|
||||||
|
|
||||||
|
Dovresti vedere:
|
||||||
|
- Nome package: `autobidder` (NON più `mimante/autobidder`)
|
||||||
|
- Tag disponibili: `latest`, `1.0.0`
|
||||||
|
- Data aggiornata ad oggi
|
||||||
|
- Digest SHA256 nuovo
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## ?? Confronto Prima/Dopo
|
||||||
|
|
||||||
|
| Aspetto | Prima (Errato) | Dopo (Corretto) |
|
||||||
|
|---------|----------------|-----------------|
|
||||||
|
| **Path Registry** | `gitea.encke-hake.ts.net/alby96/mimante` | `gitea.encke-hake.ts.net/alby96` |
|
||||||
|
| **Immagine Completa** | `gitea.encke-hake.ts.net/alby96/mimante/autobidder:latest` | `gitea.encke-hake.ts.net/alby96/autobidder:latest` |
|
||||||
|
| **Package su Gitea** | `mimante/autobidder` | `autobidder` |
|
||||||
|
| **Link Gitea** | `.../container/mimante%2Fautobidder/...` | `.../container/autobidder/...` |
|
||||||
|
| **Livelli Path** | 4 (errato) | 3 (corretto) |
|
||||||
|
| **Conforme Guida Gitea** | ? NO | ? SÌ |
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## ?? Possibili Problemi e Soluzioni
|
||||||
|
|
||||||
|
### Problema 1: Package vecchio ancora visibile
|
||||||
|
**Soluzione:** Il vecchio package `mimante/autobidder` continuerà ad esistere. Puoi:
|
||||||
|
- Eliminarlo manualmente da Gitea (Settings del package)
|
||||||
|
- Oppure lasciarlo (non interferisce con il nuovo)
|
||||||
|
|
||||||
|
### Problema 2: Autenticazione fallita
|
||||||
|
**Soluzione:**
|
||||||
|
- Usa Token PAT invece della password
|
||||||
|
- Verifica scope del token: `read:packages`, `write:packages`
|
||||||
|
- Se hai 2FA attivo, il Token è OBBLIGATORIO
|
||||||
|
|
||||||
|
### Problema 3: SSL/TLS Errors
|
||||||
|
**Soluzione:** Se Gitea usa certificati self-signed:
|
||||||
|
```bash
|
||||||
|
# Aggiungi a Docker daemon.json
|
||||||
|
{
|
||||||
|
"insecure-registries": ["gitea.encke-hake.ts.net"]
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## ? Configurazione Finale Verificata
|
||||||
|
|
||||||
|
**Tutti i requisiti soddisfatti:**
|
||||||
|
- ? Container Registry Gitea abilitato
|
||||||
|
- ? Dockerfile corretto e ottimizzato
|
||||||
|
- ? Convenzione nomi corretta (3 livelli)
|
||||||
|
- ? Profili di pubblicazione aggiornati
|
||||||
|
- ? Supporto Docker in Visual Studio
|
||||||
|
- ? Build multi-stage funzionante
|
||||||
|
- ? Healthcheck configurato
|
||||||
|
- ?? Token PAT da generare/verificare
|
||||||
|
|
||||||
|
**Prossimo step:** Genera Token PAT e testa il push!
|
||||||
Reference in New Issue
Block a user