Force download 5 #21
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build and Push Docker Image | |
on: | |
push: | |
branches: | |
- test # Déclenche sur chaque push vers la branche "test" | |
pull_request: | |
branches: | |
- test # Déclenche sur un PR vers la branche "test" | |
jobs: | |
build: | |
runs-on: ubuntu-latest # Utilise une VM Ubuntu pour la tâche | |
steps: | |
# É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 | |
# Étape 3 : Cacher les couches Docker pour accélérer les builds | |
- name: Cache Docker layers | |
uses: actions/cache@v4 | |
with: | |
path: /tmp/.buildx-cache | |
key: ${{ runner.os }}-buildx-${{ github.sha }} | |
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 }} | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
# Étape 5 : Construire et pousser l'image Docker | |
- name: Build and push Docker image | |
run: | | |
IMAGE_NAME=tiritibambix/imaguick:test | |
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 |