fixed workflow
This commit is contained in:
@@ -14,30 +14,63 @@ jobs:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Set up QEMU
|
||||
uses: docker/setup-qemu-action@v3
|
||||
# 🔧 INSTALLAZIONE DOCKER
|
||||
- name: Install Docker
|
||||
run: |
|
||||
# Aggiorna e installa dipendenze
|
||||
apt-get update
|
||||
apt-get install -y ca-certificates curl
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
# Prepara la directory per le chiavi
|
||||
install -m 0755 -d /etc/apt/keyrings
|
||||
|
||||
# Scarica la chiave GPG di Docker
|
||||
curl -fsSL https://download.docker.com/linux/debian/gpg -o /etc/apt/keyrings/docker.asc
|
||||
chmod a+r /etc/apt/keyrings/docker.asc
|
||||
|
||||
# Aggiungi il repository Docker
|
||||
tee /etc/apt/sources.list.d/docker.sources <<EOF
|
||||
Types: deb
|
||||
URIs: https://download.docker.com/linux/debian
|
||||
Suites: bookworm
|
||||
Components: stable
|
||||
Architectures: amd64
|
||||
Signed-By: /etc/apt/keyrings/docker.asc
|
||||
EOF
|
||||
|
||||
# Installa Docker
|
||||
apt-get update
|
||||
apt-get install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
|
||||
|
||||
# Verifica installazione
|
||||
docker --version
|
||||
docker compose version
|
||||
|
||||
# 🔑 LOGIN AL REGISTRY
|
||||
- name: Log in to Gitea Container Registry
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
registry: gitea.enrilinux.ovh
|
||||
username: ${{ secrets.REGISTRY_USER }}
|
||||
password: ${{ secrets.AUTHTOKEN }}
|
||||
run: |
|
||||
echo "${{ secrets.AUTHTOKEN }}" | docker login \
|
||||
-u "${{ secrets.REGISTRY_USER }}" \
|
||||
--password-stdin \
|
||||
gitea.enrilinux.ovh
|
||||
|
||||
# 📝 ESTRAI METADATI
|
||||
- name: Extract metadata
|
||||
id: meta
|
||||
run: |
|
||||
echo "REPO_NAME=$(echo ${GITHUB_REPOSITORY} | awk -F'/' '{print $2}')" >> $GITHUB_OUTPUT
|
||||
echo "SHORT_SHA=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
|
||||
echo "TAG_LATEST=gitea.enrilinux.ovh/${{ github.repository_owner }}/$(echo ${GITHUB_REPOSITORY} | awk -F'/' '{print $2}'):latest" >> $GITHUB_OUTPUT
|
||||
echo "TAG_SHA=gitea.enrilinux.ovh/${{ github.repository_owner }}/$(echo ${GITHUB_REPOSITORY} | awk -F'/' '{print $2}'):$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
|
||||
|
||||
- name: Build and push Docker image
|
||||
uses: docker/build-push-action@v5
|
||||
with:
|
||||
context: .
|
||||
push: true
|
||||
tags: |
|
||||
gitea.enrilinux.ovh/${{ github.repository_owner }}/${{ steps.meta.outputs.REPO_NAME }}:latest
|
||||
gitea.enrilinux.ovh/${{ github.repository_owner }}/${{ steps.meta.outputs.REPO_NAME }}:${{ steps.meta.outputs.SHORT_SHA }}
|
||||
# 🏗️ BUILD DELL'IMMAGINE
|
||||
- name: Build Docker image
|
||||
run: |
|
||||
docker build -t ${{ steps.meta.outputs.TAG_LATEST }} .
|
||||
docker tag ${{ steps.meta.outputs.TAG_LATEST }} ${{ steps.meta.outputs.TAG_SHA }}
|
||||
|
||||
# 📤 PUSH DELL'IMMAGINE
|
||||
- name: Push Docker image
|
||||
run: |
|
||||
docker push ${{ steps.meta.outputs.TAG_LATEST }}
|
||||
docker push ${{ steps.meta.outputs.TAG_SHA }}
|
||||
|
||||
Reference in New Issue
Block a user