Retire CI test et fichier .env Docker et corrige docker-build.yml

This commit is contained in:
2025-08-25 04:26:10 +02:00
parent 405d53374d
commit 8f31bda68a
4 changed files with 26 additions and 71 deletions

View File

@@ -1,81 +1,41 @@
name: Build and Push Docker Image
name: Create and publish a Docker image
on:
push:
branches: [ main ]
tags: [ 'v*' ]
pull_request:
branches: [ main ]
branches: ['main']
env:
REGISTRY: ghcr.io
IMAGE_NAME: skylanix/mamiehenriette
IMAGE_NAME: ${{ github.repository }}
jobs:
build:
build-and-push-image:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@v4
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to the Container registry
uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Log in to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
- name: Extract metadata
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
type=raw,value=latest,enable={{is_default_branch}}
labels: |
org.opencontainers.image.title=${{ github.repository }}
org.opencontainers.image.description=Bot multi-plateformes Discord/Twitch/YouTube pour la communauté STEvE
org.opencontainers.image.source=https://github.com/${{ github.repository }}
org.opencontainers.image.url=https://github.com/${{ github.repository }}
org.opencontainers.image.licenses=GPL-3.0
- name: Build and push
uses: docker/build-push-action@v5
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
- name: Test container startup
run: |
echo "Testing if the container starts successfully..."
docker run --rm -d --name test-container -p 5000:5000 \
-e TZ=Europe/Paris \
-e ENABLE_ZABBIX=false \
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest
# Wait for container to be ready
sleep 60
# Check if container is still running
if docker ps | grep test-container; then
echo "✅ Container started successfully"
docker logs test-container
else
echo "❌ Container failed to start"
docker logs test-container
exit 1
fi
# Stop the test container
docker stop test-container
- name: Build and push Docker image
uses: docker/build-push-action@f2a1d5e99d037542a71f64918e516c093c6f3fc4
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}