Compare commits
4
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
87a71255ce | ||
|
|
1ac3170d94 | ||
|
|
0e3ef69847 | ||
|
|
7de27f79fe |
@@ -0,0 +1,97 @@
|
|||||||
|
name: Publish Docker Image
|
||||||
|
|
||||||
|
on:
|
||||||
|
workflow_dispatch:
|
||||||
|
inputs:
|
||||||
|
proxy_mode:
|
||||||
|
description: 'Proxy mode (nginx o traefik)'
|
||||||
|
required: true
|
||||||
|
default: 'nginx'
|
||||||
|
type: choice
|
||||||
|
options:
|
||||||
|
- nginx
|
||||||
|
- traefik
|
||||||
|
push:
|
||||||
|
tags:
|
||||||
|
- 'v*'
|
||||||
|
|
||||||
|
env:
|
||||||
|
IMAGE_NAME: ${{ gitea.repository }}
|
||||||
|
IMAGE_TAG: ${{ gitea.ref_name }}
|
||||||
|
# Registry (default Docker Hub, cambia con un secret se usi un registry privato)
|
||||||
|
REGISTRY: ${{ secrets.DOCKER_REGISTRY || 'docker.io' }}
|
||||||
|
# Modalità proxy
|
||||||
|
PROXY_MODE: ${{ inputs.proxy_mode || 'nginx' }}
|
||||||
|
# Container name sulla VPS
|
||||||
|
CONTAINER_NAME: test-app
|
||||||
|
# Porta host per modalità nginx
|
||||||
|
HOST_PORT: ${{ secrets.HOST_PORT || '8080' }}
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build-and-publish:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout repository
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Set up Docker Buildx
|
||||||
|
uses: docker/setup-buildx-action@v3
|
||||||
|
|
||||||
|
- name: Log in to container registry
|
||||||
|
uses: docker/login-action@v3
|
||||||
|
with:
|
||||||
|
registry: ${{ env.REGISTRY }}
|
||||||
|
username: ${{ secrets.DOCKER_USERNAME }}
|
||||||
|
password: ${{ secrets.DOCKER_PASSWORD }}
|
||||||
|
|
||||||
|
- name: Build and push Docker image
|
||||||
|
uses: docker/build-push-action@v6
|
||||||
|
with:
|
||||||
|
context: .
|
||||||
|
push: true
|
||||||
|
tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.IMAGE_TAG }}
|
||||||
|
|
||||||
|
- name: Deploy to VPS via SSH
|
||||||
|
uses: appleboy/ssh-action@v1
|
||||||
|
with:
|
||||||
|
host: ${{ secrets.VPS_HOST }}
|
||||||
|
username: ${{ secrets.VPS_USER }}
|
||||||
|
key: ${{ secrets.VPS_SSH_KEY }}
|
||||||
|
port: ${{ secrets.VPS_PORT || '22' }}
|
||||||
|
envs: IMAGE_NAME,IMAGE_TAG,REGISTRY,PROXY_MODE,CONTAINER_NAME,HOST_PORT
|
||||||
|
script: |
|
||||||
|
set -e
|
||||||
|
|
||||||
|
FULL_IMAGE="$REGISTRY/$IMAGE_NAME:$IMAGE_TAG"
|
||||||
|
|
||||||
|
echo "=== Pull immagine ==="
|
||||||
|
echo "$DOCKER_PASSWORD" | docker login "$REGISTRY" -u "$DOCKER_USERNAME" --password-stdin 2>/dev/null || true
|
||||||
|
docker pull "$FULL_IMAGE"
|
||||||
|
|
||||||
|
echo "=== Ferma e rimuovi container esistente ==="
|
||||||
|
docker stop "$CONTAINER_NAME" 2>/dev/null || true
|
||||||
|
docker rm "$CONTAINER_NAME" 2>/dev/null || true
|
||||||
|
|
||||||
|
echo "=== Avvia container (proxy: $PROXY_MODE) ==="
|
||||||
|
|
||||||
|
if [ "$PROXY_MODE" = "traefik" ]; then
|
||||||
|
docker run -d \
|
||||||
|
--name "$CONTAINER_NAME" \
|
||||||
|
--network traefik \
|
||||||
|
--label "traefik.enable=true" \
|
||||||
|
--label "traefik.http.routers.$CONTAINER_NAME.rule=Host(\`${{ secrets.DOMAIN }}\`)" \
|
||||||
|
--label "traefik.http.services.$CONTAINER_NAME.loadbalancer.server.port=80" \
|
||||||
|
"$FULL_IMAGE"
|
||||||
|
else
|
||||||
|
docker run -d \
|
||||||
|
--name "$CONTAINER_NAME" \
|
||||||
|
-p "$HOST_PORT:80" \
|
||||||
|
"$FULL_IMAGE"
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "=== Pulizia ==="
|
||||||
|
docker image prune -f
|
||||||
|
|
||||||
|
echo "=== Deploy completato ==="
|
||||||
|
echo "Immagine: $FULL_IMAGE"
|
||||||
|
echo "Proxy: $PROXY_MODE"
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
FROM nginx:stable-alpine
|
||||||
|
|
||||||
|
COPY index.html /usr/share/nginx/html/index.html
|
||||||
|
COPY contatti.html /usr/share/nginx/html/contatti.html
|
||||||
|
|
||||||
|
EXPOSE 80
|
||||||
|
|
||||||
|
CMD ["nginx", "-g", "daemon off;"]
|
||||||
+160
@@ -0,0 +1,160 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="it">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<title>Contatti</title>
|
||||||
|
<link rel="preconnect" href="https://fonts.googleapis.com">
|
||||||
|
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
||||||
|
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;600;700&display=swap" rel="stylesheet">
|
||||||
|
<style>
|
||||||
|
* {
|
||||||
|
margin: 0;
|
||||||
|
padding: 0;
|
||||||
|
box-sizing: border-box;
|
||||||
|
}
|
||||||
|
|
||||||
|
body {
|
||||||
|
font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
|
||||||
|
min-height: 100vh;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
|
||||||
|
padding: 1rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.card {
|
||||||
|
background: rgba(255, 255, 255, 0.95);
|
||||||
|
backdrop-filter: blur(10px);
|
||||||
|
border-radius: 24px;
|
||||||
|
padding: 3rem 3.5rem;
|
||||||
|
max-width: 480px;
|
||||||
|
width: 100%;
|
||||||
|
text-align: center;
|
||||||
|
box-shadow:
|
||||||
|
0 20px 60px rgba(0, 0, 0, 0.15),
|
||||||
|
0 1px 3px rgba(0, 0, 0, 0.08);
|
||||||
|
transition: transform 0.3s ease, box-shadow 0.3s ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
.card:hover {
|
||||||
|
transform: translateY(-4px);
|
||||||
|
box-shadow:
|
||||||
|
0 30px 80px rgba(0, 0, 0, 0.2),
|
||||||
|
0 1px 3px rgba(0, 0, 0, 0.08);
|
||||||
|
}
|
||||||
|
|
||||||
|
.icon {
|
||||||
|
width: 72px;
|
||||||
|
height: 72px;
|
||||||
|
margin: 0 auto 1.5rem;
|
||||||
|
background: linear-gradient(135deg, #667eea, #764ba2);
|
||||||
|
border-radius: 50%;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
font-size: 2rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
h1 {
|
||||||
|
font-size: 1.75rem;
|
||||||
|
font-weight: 700;
|
||||||
|
color: #1a1a2e;
|
||||||
|
margin-bottom: 0.75rem;
|
||||||
|
letter-spacing: -0.02em;
|
||||||
|
}
|
||||||
|
|
||||||
|
.divider {
|
||||||
|
width: 48px;
|
||||||
|
height: 4px;
|
||||||
|
margin: 0 auto 2rem;
|
||||||
|
background: linear-gradient(90deg, #667eea, #764ba2);
|
||||||
|
border-radius: 2px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.info-list {
|
||||||
|
list-style: none;
|
||||||
|
text-align: left;
|
||||||
|
margin-bottom: 2rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.info-list li {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 0.75rem;
|
||||||
|
padding: 0.75rem 0;
|
||||||
|
border-bottom: 1px solid rgba(102, 126, 234, 0.15);
|
||||||
|
color: #555;
|
||||||
|
font-size: 0.95rem;
|
||||||
|
line-height: 1.5;
|
||||||
|
}
|
||||||
|
|
||||||
|
.info-list li:last-child {
|
||||||
|
border-bottom: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.info-list .info-icon {
|
||||||
|
width: 36px;
|
||||||
|
height: 36px;
|
||||||
|
min-width: 36px;
|
||||||
|
background: linear-gradient(135deg, #667eea, #764ba2);
|
||||||
|
border-radius: 50%;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
font-size: 1rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.home-link {
|
||||||
|
display: inline-block;
|
||||||
|
padding: 0.6rem 1.6rem;
|
||||||
|
background: linear-gradient(135deg, #667eea, #764ba2);
|
||||||
|
color: #fff;
|
||||||
|
border-radius: 100px;
|
||||||
|
font-size: 0.85rem;
|
||||||
|
font-weight: 600;
|
||||||
|
text-decoration: none;
|
||||||
|
letter-spacing: 0.02em;
|
||||||
|
transition: transform 0.3s ease, box-shadow 0.3s ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
.home-link:hover {
|
||||||
|
transform: translateY(-2px);
|
||||||
|
box-shadow: 0 8px 24px rgba(102, 126, 234, 0.4);
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (max-width: 480px) {
|
||||||
|
.card {
|
||||||
|
padding: 2rem 1.5rem;
|
||||||
|
border-radius: 16px;
|
||||||
|
}
|
||||||
|
h1 {
|
||||||
|
font-size: 1.4rem;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div class="card">
|
||||||
|
<div class="icon">📞</div>
|
||||||
|
<div class="divider"></div>
|
||||||
|
<h1>Contatti</h1>
|
||||||
|
<ul class="info-list">
|
||||||
|
<li>
|
||||||
|
<span class="info-icon">✉️</span>
|
||||||
|
<span>info@esempio.it</span>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<span class="info-icon">📱</span>
|
||||||
|
<span>+39 012 345 6789</span>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<span class="info-icon">📍</span>
|
||||||
|
<span>Via Roma 1, 00100 Roma (RM)</span>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
<a href="index.html" class="home-link">Torna alla Home</a>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
@@ -109,6 +109,7 @@
|
|||||||
<h1>Pagina di prova</h1>
|
<h1>Pagina di prova</h1>
|
||||||
<p>Questa è una pagina HTML di test realizzata con cura per un aspetto più elegante e moderno.</p>
|
<p>Questa è una pagina HTML di test realizzata con cura per un aspetto più elegante e moderno.</p>
|
||||||
<span class="badge">HTML · CSS · Design</span>
|
<span class="badge">HTML · CSS · Design</span>
|
||||||
|
<a href="contatti.html" class="badge" style="margin-top: 1rem; text-decoration: none; display: block; width: fit-content; margin-left: auto; margin-right: auto; cursor: pointer;">Contatti</a>
|
||||||
</div>
|
</div>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
@@ -0,0 +1,30 @@
|
|||||||
|
# Piano
|
||||||
|
|
||||||
|
## Obiettivo
|
||||||
|
Creare una pagina di contatti (`contatti.html`) coerente con il design esistente (glassmorphism, gradienti viola, font Inter), collegata alla pagina principale tramite un link di navigazione.
|
||||||
|
|
||||||
|
## Task
|
||||||
|
1. **Creare `contatti.html`** — Nuova pagina HTML con stessa struttura CSS di `index.html` (gradienti, card glassmorphism, responsive). Contenuto: icona contatto, titolo "Contatti", sezione con info (email, telefono, indirizzo), link/bottone per tornare alla home.
|
||||||
|
- File: `contatti.html` (nuovo)
|
||||||
|
|
||||||
|
2. **Aggiungere navigazione in `index.html`** — Inserire un link/bottone nella card che punta a `contatti.html`, mantenendo lo stile badge esistente.
|
||||||
|
- File: `index.html`
|
||||||
|
|
||||||
|
3. **Aggiornare `Dockerfile`** — Aggiungere una riga `COPY` per servire anche `contatti.html` via nginx.
|
||||||
|
- File: `Dockerfile`
|
||||||
|
|
||||||
|
## Acceptance Criteria
|
||||||
|
- [ ] `contatti.html` esiste e contiene informazioni di contatto (email, telefono, indirizzo)
|
||||||
|
- [ ] La pagina di contatti usa lo stesso design system (gradienti `#667eea`→`#764ba2`, card glassmorphism, font Inter, `border-radius: 24px`)
|
||||||
|
- [ ] `contatti.html` è responsive (media query `max-width: 480px`)
|
||||||
|
- [ ] `index.html` contiene un link visibile che naviga a `contatti.html`
|
||||||
|
- [ ] `contatti.html` contiene un link per tornare alla home (`index.html`)
|
||||||
|
- [ ] Il `Dockerfile` copia entrambi i file HTML nella directory nginx
|
||||||
|
- [ ] La pagina è in italiano (`lang="it"`)
|
||||||
|
|
||||||
|
## Verifica
|
||||||
|
- Aprire `index.html` nel browser e verificare che il link alla pagina contatti sia visibile e cliccabile
|
||||||
|
- Verificare che `contatti.html` si apre correttamente con le info di contatto
|
||||||
|
- Verificare che il link "torna alla home" in `contatti.html` funziona
|
||||||
|
- Verificare il layout responsive ridimensionando la finestra sotto 480px
|
||||||
|
- Eseguire `docker build -t test-app .` per confermare che il build Docker riesce senza errori
|
||||||
Reference in New Issue
Block a user