Rimosso override esplicito porta HTTP in Program.cs: ora la porta è gestita solo da ASPNETCORE_URLS (default 8080), risolvendo il bug che impediva l’accesso web al container. Aggiornati Dockerfile, docker-compose.yml e documentazione per riflettere la nuova configurazione. Versione incrementata a 1.1.1 (PATCH). HTTPS resta disabilitato di default; configurazione centralizzata e override semplice via env. Aggiunti changelog, troubleshooting e script bump-version aggiornato.
7.0 KiB
7.0 KiB
? RIEPILOGO COMPLETO - CONFIGURAZIONE DOCKER + GITEA
?? Problemi Risolti
1. ? Convenzione Nomi Registry Gitea
Problema: Path errato con 4 livelli invece di 3
- ? Prima:
gitea.../alby96/mimante/autobidder - ? Dopo:
gitea.../alby96/autobidder
2. ? Errore Visual Studio "ContainerBuild"
Problema: Profilo usava WebPublishMethod=Docker senza SDK
- ? Prima: Richiede Microsoft.Docker.Sdk
- ? Dopo:
WebPublishMethod=Customsenza dipendenze
3. ? Container HTTPS Crash
Problema: Kestrel cerca certificati HTTPS inesistenti
- ? Prima: HTTPS abilitato di default, crash all'avvio
- ? Dopo: HTTP only (8080), HTTPS opzionale
?? File Modificati
| File | Modifica | Motivo |
|---|---|---|
AutoBidder.csproj |
<ContainerRegistry> corretto |
Convenzione Gitea 3 livelli |
AutoBidder.csproj |
Post-build target aggiunto | Push automatico su Gitea |
GiteaRegistry.pubxml |
WebPublishMethod=Custom |
Nessuna dipendenza SDK Docker |
GiteaRegistry.pubxml |
Target DockerBuild |
Build Docker integrato |
Program.cs |
enableHttps=false default |
HTTPS disabilitato in container |
Program.cs |
Porta 8080 |
Standard container HTTP |
Dockerfile |
ENV Kestrel__EnableHttps=false |
Conferma HTTP only |
Dockerfile |
EXPOSE 8080 |
Porta HTTP standard |
docker-compose.yml |
5000:8080 port mapping |
Host:Container corretto |
?? Workflow Finale
Da Visual Studio (1 Click)
1. Tasto destro progetto ? Pubblica ? GiteaRegistry
2. Visual Studio:
?? Build .NET (Release)
?? Target DockerBuild (profilo) ? docker build
?? Post-build Gitea (csproj) ? tag + push
?? ? SUCCESS!
Output Completo
?????????????????????????????????????????????????????????????????????
? 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! ?
?????????????????????????????????????????????????????????????????????
?? Configurazione Container
Porte
| Ambiente | Host | Container | Protocollo |
|---|---|---|---|
| Development | 5001 | 5001 | HTTPS (dev cert) |
| Docker/Production | 5000 | 8080 | HTTP |
| HTTPS Production | 443 | 8443 | HTTPS (con cert) |
Variabili Ambiente
# Container standard (HTTP only)
ASPNETCORE_URLS=http://+:8080
ASPNETCORE_ENVIRONMENT=Production
Kestrel__EnableHttps=false
# Con HTTPS (opzionale, richiede certificato)
Kestrel__EnableHttps=true
Kestrel__Certificates__Default__Path=/certs/cert.pfx
Kestrel__Certificates__Default__Password=password
?? Deploy su Gitea
Immagini Pubblicate
gitea.encke-hake.ts.net/alby96/autobidder:latest
gitea.encke-hake.ts.net/alby96/autobidder:1.0.0
Link Gitea:
https://gitea.encke-hake.ts.net/Alby96/-/packages/container/autobidder
Versionamento Automatico
<!-- AutoBidder.csproj -->
<Version>1.0.1</Version> ? Incrementa qui
Pubblica ? Crea automaticamente:
- Tag
latest(aggiornato) - Tag
1.0.1(nuovo)
?? Comandi Rapidi
Autenticazione Gitea
docker login gitea.encke-hake.ts.net
# Username: Alby96
# Password: [TOKEN PAT]
Build Locale + Test
# Build
docker build -t autobidder:test .
# Test locale
docker run -p 5000:8080 \
-v $(pwd)/Data:/app/Data \
autobidder:test
# Apri: http://localhost:5000
Pull da Gitea
# Latest
docker pull gitea.encke-hake.ts.net/alby96/autobidder:latest
# Versione specifica (production)
docker pull gitea.encke-hake.ts.net/alby96/autobidder:1.0.0
Deploy Production
docker run -d \
--name autobidder \
-p 5000:8080 \
-v /data/autobidder:/app/Data \
-v /logs/autobidder:/app/logs \
-e ASPNETCORE_ENVIRONMENT=Production \
--restart unless-stopped \
gitea.encke-hake.ts.net/alby96/autobidder:1.0.0
Docker Compose
# Start
docker-compose up -d
# Logs
docker-compose logs -f autobidder
# Stop
docker-compose down
# Rebuild
docker-compose up -d --build
?? Reverse Proxy (HTTPS in Production)
Nginx
server {
listen 443 ssl http2;
server_name autobidder.example.com;
ssl_certificate /etc/nginx/ssl/cert.pem;
ssl_certificate_key /etc/nginx/ssl/key.pem;
location / {
proxy_pass http://autobidder:8080;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
}
Traefik
services:
autobidder:
image: gitea.encke-hake.ts.net/alby96/autobidder:latest
labels:
- "traefik.enable=true"
- "traefik.http.routers.autobidder.rule=Host(`autobidder.example.com`)"
- "traefik.http.routers.autobidder.tls=true"
- "traefik.http.routers.autobidder.tls.certresolver=letsencrypt"
- "traefik.http.services.autobidder.loadbalancer.server.port=8080"
?? Checklist Finale
Configurazione
- Convenzione Gitea corretta (3 livelli)
- Versionamento automatico da
.csproj - HTTPS disabilitato in container
- Porta HTTP 8080 (standard)
- Post-build push automatico
- Profilo Visual Studio senza errori
Pubblicazione
- Build locale funziona
- Docker build funziona
- Tag Gitea creati (
latest+ versione) - Push su Gitea riuscito
- Immagini visibili su Gitea
- Visual Studio SUCCESS
Container
- Container si avvia senza errori
- HTTP accessibile su porta 8080
- Volumi persistenti configurati
- Healthcheck funzionante
- Logs visibili
Documentazione
- DOCKER_PUBLISH_GUIDE.md completa
- PROBLEMA_RISOLTO.md (Visual Studio)
- PROBLEMA_HTTPS_RISOLTO.md (Container)
- CONFIGURAZIONE_FINALE.md
- NUOVO_WORKFLOW_RIEPILOGO.md
- Questo riepilogo
?? STATO: TUTTO FUNZIONANTE!
Workflow completo e testato:
- ? Modifica codice
- ? Incrementa versione in
.csproj - ? Pubblica da Visual Studio (1 click)
- ? Immagini su Gitea (latest + versione)
- ? Deploy su Unraid/Docker
Nessun errore, tutto automatico, versionamento tracciato! ??