Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

All formats properly handled, code refactor #3

Merged
merged 9 commits into from
Dec 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 20 additions & 13 deletions .github/workflows/docker-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,25 @@ name: Build and Push Docker Image
on:
push:
branches:
- main # Déclenche le workflow sur chaque push vers la branche "main"
- main # Déclenche sur chaque push vers la branche "test"
pull_request:
branches:
- main # Déclenche sur un PR vers "main" (si besoin)
- main # Déclenche sur un PR vers la branche "test"

jobs:
build:
runs-on: ubuntu-latest # Utilise une machine virtuelle Ubuntu pour construire l'image
runs-on: ubuntu-latest # Utilise une VM Ubuntu pour la tâche

steps:
- name: Checkout the repository
uses: actions/checkout@v2 # Clone le code du repo
# Étape 1 : Cloner le dépôt
- name: Checkout repository
uses: actions/checkout@v3

# Étape 2 : Configurer Docker Buildx
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2 # Configure Buildx, l'outil pour construire l'image
uses: docker/setup-buildx-action@v2

# Étape 3 : Cacher les couches Docker pour accélérer les builds
- name: Cache Docker layers
uses: actions/cache@v4
with:
Expand All @@ -27,18 +30,22 @@ jobs:
restore-keys: |
${{ runner.os }}-buildx-

# Étape 4 : Se connecter à Docker Hub
- name: Log in to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }} # Nom d'utilisateur Docker Hub
password: ${{ secrets.DOCKER_PASSWORD }} # Mot de passe Docker Hub (stocké dans les secrets GitHub)
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

# Étape 5 : Construire et pousser l'image Docker
- name: Build and push Docker image
run: |
docker build -t tiritibambix/imaguick:latest .
docker push tiritibambix/imaguick:latest
# Construire et pousser l'image vers Docker Hub
IMAGE_NAME=tiritibambix/imaguick:latest
docker buildx build --cache-from=type=local,src=/tmp/.buildx-cache \
--cache-to=type=local,dest=/tmp/.buildx-cache \
--push \
-t $IMAGE_NAME .

# Étape 6 : Se déconnecter de Docker Hub
- name: Logout from Docker Hub
run: docker logout # Se déconnecter de Docker Hub après avoir poussé l'image
#
run: docker logout
Loading
Loading