From 972dc5cee8f1481ce322bd0553ebbdba7c9c7c3f Mon Sep 17 00:00:00 2001 From: "d.viti" Date: Sat, 20 Sep 2025 00:14:41 +0200 Subject: [PATCH] aggiunto docker --- .gitea/workflows/build.yml | 46 +++++++++++++++++++++++ Dockerfile | 7 ++++ README.md | 77 +++++++++++++++++++++++++++++++++++++- 3 files changed, 129 insertions(+), 1 deletion(-) create mode 100644 .gitea/workflows/build.yml create mode 100644 Dockerfile diff --git a/.gitea/workflows/build.yml b/.gitea/workflows/build.yml new file mode 100644 index 0000000..886d057 --- /dev/null +++ b/.gitea/workflows/build.yml @@ -0,0 +1,46 @@ +name: Build and Deploy + +on: + push: + branches: [main] + pull_request: + branches: [main] + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Log in to Gitea Container Registry + if: github.event_name == 'push' + uses: docker/login-action@v3 + with: + registry: git.commandware.com + username: ${{ secrets.USERNAME }} + password: ${{ secrets.TOKEN }} + + - name: Extract metadata + id: meta + uses: docker/metadata-action@v5 + with: + images: git.commandware.com/dnviti/calcolatore_prezzi_software + tags: | + type=ref,event=branch + type=ref,event=pr + type=sha + + - name: Build and push Docker image + uses: docker/build-push-action@v5 + with: + context: . + push: ${{ github.event_name == 'push' }} + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} + cache-from: type=gha + cache-to: type=gha,mode=max diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..4790254 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,7 @@ +FROM nginx:alpine + +COPY index.html /usr/share/nginx/html/ + +EXPOSE 80 + +CMD ["nginx", "-g", "daemon off;"] \ No newline at end of file diff --git a/README.md b/README.md index 10fc8c0..c1011be 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,77 @@ -# calcolatore_prezzi_software +# Calcolatore Prezzi Software +Un'applicazione web per calcolare i prezzi di progetti software in base a diversi parametri e metodologie di stima. + +## Caratteristiche + +- Interfaccia utente moderna e responsive +- Calcolo automatico dei prezzi basato su parametri configurabili +- Supporto per diverse metodologie di stima +- Design ottimizzato per il mercato italiano + +## Installazione e Utilizzo + +### Utilizzo con Docker + +1. **Costruire l'immagine Docker:** + ```bash + docker build -t git.commandware.com/dnviti/calcolatore_prezzi_software . + ``` + +2. **Eseguire il container:** + ```bash + docker run -p 8080:80 git.commandware.com/dnviti/calcolatore_prezzi_software + ``` + +3. **Oppure utilizzare l'immagine dal registry:** + ```bash + docker pull git.commandware.com/dnviti/calcolatore_prezzi_software:main + docker run -p 8080:80 git.commandware.com/dnviti/calcolatore_prezzi_software:main + ``` + +3. **Accedere all'applicazione:** + Aprire il browser e navigare a `http://localhost:8080` + +### Sviluppo Locale + +Per sviluppo locale, aprire semplicemente il file `index.html` in un browser web. + +## Deployment + +Il progetto include una pipeline CI/CD per Gitea che automaticamente: + +- Costruisce l'immagine Docker +- Pubblica sul registry Gitea (git.commandware.com) +- Si attiva su push al branch `main` o su pull request + +### Configurazione Secrets + +Per utilizzare la pipeline, configurare i seguenti secrets nel repository Gitea: + +- `GITEA_USERNAME`: Username Gitea +- `GITEA_TOKEN`: Token di accesso Gitea con permessi di scrittura al registry + +## Struttura del Progetto + +``` +. +├── index.html # Applicazione web principale +├── Dockerfile # Configurazione Docker +├── .gitea/ +│ └── workflows/ +│ └── build.yml # Pipeline CI/CD +└── README.md # Documentazione +``` + +## Tecnologie Utilizzate + +- HTML5 +- CSS3 (Tailwind CSS) +- JavaScript +- Nginx (per serving statico) +- Docker +- Gitea Actions + +## Licenza + +[Inserire informazioni sulla licenza] \ No newline at end of file