From 037623d1584798cbab9c18a9ddf0f37c5ed95923 Mon Sep 17 00:00:00 2001 From: maneaGauthier Date: Wed, 1 Oct 2025 08:58:26 +0200 Subject: [PATCH 01/30] add dockerfile --- Dockerfile | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..1b3d949 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,15 @@ +FROM nginx:stable + +RUN apt-get update && apt-get install -y --no-install-recommends file \ + && rm -rf /var/lib/apt/lists/* + +RUN mkdir -p /var/concentration/html + +COPY conf/nginx.conf /etc/nginx/nginx.conf + +COPY html/ /var/concentration/html/ + +EXPOSE 80 + + +CMD ["nginx", "-g", "daemon off;"] From 77b39761ee90b1f7b4f9d00cd7d5c55c63994189 Mon Sep 17 00:00:00 2001 From: maneaGauthier Date: Wed, 1 Oct 2025 10:28:21 +0200 Subject: [PATCH 02/30] Partie 4 --- .github/workflows/memory.yml | 67 ++++++++++++++++++++++++++++++++++++ 1 file changed, 67 insertions(+) create mode 100644 .github/workflows/memory.yml diff --git a/.github/workflows/memory.yml b/.github/workflows/memory.yml new file mode 100644 index 0000000..33dcbde --- /dev/null +++ b/.github/workflows/memory.yml @@ -0,0 +1,67 @@ +name: memory-2026 + +on: + push: + branches: [develop] + +jobs: + # 4.1 - Test: exécuter "file" sur les JPG + # (on utilise un conteneur Debian pour avoir l'outil 'file' même sous Windows) + test-memory-2026: + runs-on: self-hosted + steps: + - uses: actions/checkout@v4 + - name: Run "file" on JPGs via Debian + shell: bash + run: | + docker run --rm -v "$PWD":/work -w /work debian:stable-slim bash -lc ' + apt-get update >/dev/null && apt-get install -y file >/dev/null + shopt -s nullglob + files=($(git ls-files "*.jpg" "*.jpeg")) + if [ ${#files[@]} -eq 0 ]; then + echo "Aucun .jpg/.jpeg"; exit 0 + fi + for f in "${files[@]}"; do + echo "==> $f" + file "$f" + done + ' + + # 4.2 - Build: construire l'image /memory-2026 + build-memory-2026: + runs-on: self-hosted + needs: test-memory-2026 + steps: + - uses: actions/checkout@v4 + - name: Docker build + run: docker build -t ${{ secrets.DOCKERHUB_USERNAME }}/memory-2026:latest . + + # 4.3 - Push: pousser sur Docker Hub avec tes identifiants + push-memory-2026: + runs-on: self-hosted + needs: build-memory-2026 + steps: + - name: Docker login + run: echo "${{ secrets.DOCKERHUB_TOKEN }}" | docker login -u "${{ secrets.DOCKERHUB_USERNAME }}" --password-stdin + - name: Docker push + run: docker push ${{ secrets.DOCKERHUB_USERNAME }}/memory-2026:latest + + # 4.4 - Deploy: SSH sur TA machine (Windows local), pull & run en 80:80 + deploy-memory-2026: + runs-on: self-hosted + needs: push-memory-2026 + steps: + - name: Setup SSH key + env: + SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }} + run: | + mkdir -p ~/.ssh + echo "$SSH_PRIVATE_KEY" > ~/.ssh/id_rsa + chmod 600 ~/.ssh/id_rsa + - name: Deploy to local Windows (127.0.0.1) + env: + SSH_USER: ${{ secrets.SSH_USER }} + SSH_HOST: ${{ secrets.SSH_HOST }} + DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }} + run: | + ssh -o StrictHostKeyChecking=no $env:SSH_USER@$env:SSH_HOST "docker pull $env:DOCKERHUB_USERNAME/memory-2026:latest; docker stop memory-2026 2>`$null; docker rm memory-2026 2>`$null; docker run -d --name memory-2026 -p 80:80 $env:DOCKERHUB_USERNAME/memory-2026:latest" From 2b98450daa23721eab348dbe0335d7c4ccc6d64d Mon Sep 17 00:00:00 2001 From: maneaGauthier Date: Wed, 1 Oct 2025 10:29:34 +0200 Subject: [PATCH 03/30] trigger CI From 6a777aecebf1c0f7de552cf91f5ae091343b632c Mon Sep 17 00:00:00 2001 From: maneaGauthier Date: Wed, 1 Oct 2025 10:39:19 +0200 Subject: [PATCH 04/30] Partie 4 fix --- .github/workflows/memory.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/memory.yml b/.github/workflows/memory.yml index 33dcbde..f579406 100644 --- a/.github/workflows/memory.yml +++ b/.github/workflows/memory.yml @@ -8,7 +8,7 @@ jobs: # 4.1 - Test: exécuter "file" sur les JPG # (on utilise un conteneur Debian pour avoir l'outil 'file' même sous Windows) test-memory-2026: - runs-on: self-hosted + runs-on: [self-hosted, Windows, X64] steps: - uses: actions/checkout@v4 - name: Run "file" on JPGs via Debian @@ -29,7 +29,7 @@ jobs: # 4.2 - Build: construire l'image /memory-2026 build-memory-2026: - runs-on: self-hosted + runs-on: [self-hosted, Windows, X64] needs: test-memory-2026 steps: - uses: actions/checkout@v4 @@ -38,7 +38,7 @@ jobs: # 4.3 - Push: pousser sur Docker Hub avec tes identifiants push-memory-2026: - runs-on: self-hosted + runs-on: [self-hosted, Windows, X64] needs: build-memory-2026 steps: - name: Docker login @@ -48,7 +48,7 @@ jobs: # 4.4 - Deploy: SSH sur TA machine (Windows local), pull & run en 80:80 deploy-memory-2026: - runs-on: self-hosted + runs-on: [self-hosted, Windows, X64] needs: push-memory-2026 steps: - name: Setup SSH key From c11afad271140d6f0139bd5b03031e487df12a93 Mon Sep 17 00:00:00 2001 From: maneaGauthier Date: Wed, 1 Oct 2025 10:42:08 +0200 Subject: [PATCH 05/30] Partie 4 fix --- .github/workflows/verify-runner.yml | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 .github/workflows/verify-runner.yml diff --git a/.github/workflows/verify-runner.yml b/.github/workflows/verify-runner.yml new file mode 100644 index 0000000..06cfc85 --- /dev/null +++ b/.github/workflows/verify-runner.yml @@ -0,0 +1,8 @@ +name: verify-runner +on: [workflow_dispatch] +jobs: + ping: + runs-on: [self-hosted, Windows, X64] + steps: + - run: 'Write-Host "Runner OK. User:" $env:USERNAME' # PowerShell par défaut sur Windows + - run: docker --version From 8cabc3e4a2d010d4c503f8cf11e7b8b5f6eb1668 Mon Sep 17 00:00:00 2001 From: maneaGauthier Date: Wed, 1 Oct 2025 10:50:40 +0200 Subject: [PATCH 06/30] add verify-runner --- .github/workflows/verify-runner.yml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/.github/workflows/verify-runner.yml b/.github/workflows/verify-runner.yml index 06cfc85..4b47088 100644 --- a/.github/workflows/verify-runner.yml +++ b/.github/workflows/verify-runner.yml @@ -1,8 +1,12 @@ name: verify-runner -on: [workflow_dispatch] +on: + workflow_dispatch: + push: + branches: [develop] + jobs: ping: runs-on: [self-hosted, Windows, X64] steps: - - run: 'Write-Host "Runner OK. User:" $env:USERNAME' # PowerShell par défaut sur Windows + - run: 'Write-Host "Runner OK. User: $env:USERNAME"' - run: docker --version From e7f6efba28e9d897e1a0f241d1b7fd9c93a8e107 Mon Sep 17 00:00:00 2001 From: maneaGauthier Date: Wed, 1 Oct 2025 10:56:20 +0200 Subject: [PATCH 07/30] add verify-runner --- .github/workflows/verify-runner.yml | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/.github/workflows/verify-runner.yml b/.github/workflows/verify-runner.yml index 4b47088..d51aa86 100644 --- a/.github/workflows/verify-runner.yml +++ b/.github/workflows/verify-runner.yml @@ -8,5 +8,18 @@ jobs: ping: runs-on: [self-hosted, Windows, X64] steps: - - run: 'Write-Host "Runner OK. User: $env:USERNAME"' - - run: docker --version + - name: Print env + shell: powershell + run: | + Write-Host "Runner OK" + Write-Host "User: $env:USERNAME" + Write-Host "PWD: $pwd" + + - name: Check Docker (optional) + shell: powershell + run: | + if (Get-Command docker -ErrorAction SilentlyContinue) { + docker version + } else { + Write-Host "Docker not found on runner (ok for this test)" + } From b329c96b57fe7b2d57c7b53aac3c7be9801048cc Mon Sep 17 00:00:00 2001 From: maneaGauthier Date: Wed, 1 Oct 2025 11:07:20 +0200 Subject: [PATCH 08/30] fix verify-runner --- .github/workflows/verify-runner.yml | 18 +----------------- 1 file changed, 1 insertion(+), 17 deletions(-) diff --git a/.github/workflows/verify-runner.yml b/.github/workflows/verify-runner.yml index d51aa86..f5f57db 100644 --- a/.github/workflows/verify-runner.yml +++ b/.github/workflows/verify-runner.yml @@ -1,25 +1,9 @@ -name: verify-runner -on: - workflow_dispatch: - push: - branches: [develop] - jobs: ping: - runs-on: [self-hosted, Windows, X64] + runs-on: self-hosted steps: - name: Print env shell: powershell run: | Write-Host "Runner OK" Write-Host "User: $env:USERNAME" - Write-Host "PWD: $pwd" - - - name: Check Docker (optional) - shell: powershell - run: | - if (Get-Command docker -ErrorAction SilentlyContinue) { - docker version - } else { - Write-Host "Docker not found on runner (ok for this test)" - } From 7d1ff3eae714bc9000ee541ea262295cb2691f49 Mon Sep 17 00:00:00 2001 From: maneaGauthier Date: Wed, 1 Oct 2025 11:08:38 +0200 Subject: [PATCH 09/30] fix verify-runner --- .github/workflows/memory.yml | 67 ------------------------------------ 1 file changed, 67 deletions(-) diff --git a/.github/workflows/memory.yml b/.github/workflows/memory.yml index f579406..e69de29 100644 --- a/.github/workflows/memory.yml +++ b/.github/workflows/memory.yml @@ -1,67 +0,0 @@ -name: memory-2026 - -on: - push: - branches: [develop] - -jobs: - # 4.1 - Test: exécuter "file" sur les JPG - # (on utilise un conteneur Debian pour avoir l'outil 'file' même sous Windows) - test-memory-2026: - runs-on: [self-hosted, Windows, X64] - steps: - - uses: actions/checkout@v4 - - name: Run "file" on JPGs via Debian - shell: bash - run: | - docker run --rm -v "$PWD":/work -w /work debian:stable-slim bash -lc ' - apt-get update >/dev/null && apt-get install -y file >/dev/null - shopt -s nullglob - files=($(git ls-files "*.jpg" "*.jpeg")) - if [ ${#files[@]} -eq 0 ]; then - echo "Aucun .jpg/.jpeg"; exit 0 - fi - for f in "${files[@]}"; do - echo "==> $f" - file "$f" - done - ' - - # 4.2 - Build: construire l'image /memory-2026 - build-memory-2026: - runs-on: [self-hosted, Windows, X64] - needs: test-memory-2026 - steps: - - uses: actions/checkout@v4 - - name: Docker build - run: docker build -t ${{ secrets.DOCKERHUB_USERNAME }}/memory-2026:latest . - - # 4.3 - Push: pousser sur Docker Hub avec tes identifiants - push-memory-2026: - runs-on: [self-hosted, Windows, X64] - needs: build-memory-2026 - steps: - - name: Docker login - run: echo "${{ secrets.DOCKERHUB_TOKEN }}" | docker login -u "${{ secrets.DOCKERHUB_USERNAME }}" --password-stdin - - name: Docker push - run: docker push ${{ secrets.DOCKERHUB_USERNAME }}/memory-2026:latest - - # 4.4 - Deploy: SSH sur TA machine (Windows local), pull & run en 80:80 - deploy-memory-2026: - runs-on: [self-hosted, Windows, X64] - needs: push-memory-2026 - steps: - - name: Setup SSH key - env: - SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }} - run: | - mkdir -p ~/.ssh - echo "$SSH_PRIVATE_KEY" > ~/.ssh/id_rsa - chmod 600 ~/.ssh/id_rsa - - name: Deploy to local Windows (127.0.0.1) - env: - SSH_USER: ${{ secrets.SSH_USER }} - SSH_HOST: ${{ secrets.SSH_HOST }} - DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }} - run: | - ssh -o StrictHostKeyChecking=no $env:SSH_USER@$env:SSH_HOST "docker pull $env:DOCKERHUB_USERNAME/memory-2026:latest; docker stop memory-2026 2>`$null; docker rm memory-2026 2>`$null; docker run -d --name memory-2026 -p 80:80 $env:DOCKERHUB_USERNAME/memory-2026:latest" From ab17860f831450e9743f0658ed008a83a77a3d2b Mon Sep 17 00:00:00 2001 From: maneaGauthier Date: Wed, 1 Oct 2025 11:11:40 +0200 Subject: [PATCH 10/30] fix verify-runner --- .github/workflows/verify-runner.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.github/workflows/verify-runner.yml b/.github/workflows/verify-runner.yml index f5f57db..a6ce62f 100644 --- a/.github/workflows/verify-runner.yml +++ b/.github/workflows/verify-runner.yml @@ -1,3 +1,10 @@ +name: verify-runner + +on: + workflow_dispatch: + push: + branches: [develop] + jobs: ping: runs-on: self-hosted From cf2deadc871e4f51dca9b5c31968fc153c9b6cd3 Mon Sep 17 00:00:00 2001 From: maneaGauthier Date: Wed, 1 Oct 2025 11:17:38 +0200 Subject: [PATCH 11/30] fix verify-runner --- .github/workflows/memory.yml | 66 ++++++++++++++++++++++++++++++++++++ 1 file changed, 66 insertions(+) diff --git a/.github/workflows/memory.yml b/.github/workflows/memory.yml index e69de29..76b3fb3 100644 --- a/.github/workflows/memory.yml +++ b/.github/workflows/memory.yml @@ -0,0 +1,66 @@ +name: memory-2026 + +on: + push: + branches: [develop] + +jobs: + # 4.1 — TEST : exécuter "file" sur tous les JPG/JPEG + test-memory-2026: + runs-on: self-hosted + steps: + - uses: actions/checkout@v4 + - name: Run "file" on JPGs via Debian (inside Docker) + run: | + docker run --rm -v "$PWD:/work" -w /work debian:stable-slim bash -lc ' + set -e + apt-get update >/dev/null && apt-get install -y file >/dev/null + count=$(find . -type f \( -iname "*.jpg" -o -iname "*.jpeg" \) | wc -l) + if [ "$count" -eq 0 ]; then echo "Aucun .jpg/.jpeg"; exit 0; fi + find . -type f \( -iname "*.jpg" -o -iname "*.jpeg" \) -print0 | xargs -0 file + ' + + # 4.2 — BUILD : construire l'image /memory-2026:latest + build-memory-2026: + runs-on: self-hosted + needs: test-memory-2026 + steps: + - uses: actions/checkout@v4 + - name: Docker build + run: docker build -t $env:DOCKERHUB_USERNAME/memory-2026:latest . + + # 4.3 — PUSH : pousser sur Docker Hub + push-memory-2026: + runs-on: self-hosted + needs: build-memory-2026 + steps: + - name: Docker login + run: | + "${{ secrets.DOCKERHUB_TOKEN }}" | docker login -u "${{ secrets.DOCKERHUB_USERNAME }}" --password-stdin + - name: Docker push + run: docker push ${{ secrets.DOCKERHUB_USERNAME }}/memory-2026:latest + + # 4.4 — DEPLOY : SSH vers TA machine, pull et run en 80:80 + deploy-memory-2026: + runs-on: self-hosted + needs: push-memory-2026 + steps: + - name: Setup SSH key (Windows) + shell: powershell + env: + SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }} + run: | + New-Item -ItemType Directory -Force "$HOME\.ssh" | Out-Null + Set-Content -Path "$HOME\.ssh\id_rsa" -Value $env:SSH_PRIVATE_KEY -NoNewline + icacls "$HOME\.ssh\id_rsa" /inheritance:r /grant:r "$env:USERNAME:(R)" | Out-Null + - name: Deploy to target via SSH + shell: powershell + env: + SSH_USER: ${{ secrets.SSH_USER }} + SSH_HOST: ${{ secrets.SSH_HOST }} + DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }} + run: | + $image = "$env:DOCKERHUB_USERNAME/memory-2026:latest" + # $null doit rester côté machine distante → on échappe $ en `$ + $remote = "docker pull $image; docker stop memory-2026 *> `$null; docker rm memory-2026 *> `$null; docker run -d --name memory-2026 -p 80:80 $image" + ssh -o StrictHostKeyChecking=no "$env:SSH_USER@$env:SSH_HOST" "$remote" From 8ac67467fd45a5d3555e3d8f4e92847b378f6cb4 Mon Sep 17 00:00:00 2001 From: maneaGauthier Date: Wed, 1 Oct 2025 11:22:17 +0200 Subject: [PATCH 12/30] fix --- .github/workflows/memory.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/memory.yml b/.github/workflows/memory.yml index 76b3fb3..edb03b6 100644 --- a/.github/workflows/memory.yml +++ b/.github/workflows/memory.yml @@ -11,8 +11,11 @@ jobs: steps: - uses: actions/checkout@v4 - name: Run "file" on JPGs via Debian (inside Docker) + shell: powershell run: | - docker run --rm -v "$PWD:/work" -w /work debian:stable-slim bash -lc ' + # Chemin du repo (converti en / pour Docker) + $work = "${env:GITHUB_WORKSPACE}".Replace('\','/') + docker run --rm -v "$work:/work" -w /work debian:stable-slim bash -lc ' set -e apt-get update >/dev/null && apt-get install -y file >/dev/null count=$(find . -type f \( -iname "*.jpg" -o -iname "*.jpeg" \) | wc -l) From c9471d35a8640af62b457433690cc8b3022cb0e9 Mon Sep 17 00:00:00 2001 From: maneaGauthier Date: Wed, 1 Oct 2025 11:24:44 +0200 Subject: [PATCH 13/30] fix --- .github/workflows/memory.yml | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/.github/workflows/memory.yml b/.github/workflows/memory.yml index edb03b6..7cf92b6 100644 --- a/.github/workflows/memory.yml +++ b/.github/workflows/memory.yml @@ -6,22 +6,26 @@ on: jobs: # 4.1 — TEST : exécuter "file" sur tous les JPG/JPEG - test-memory-2026: + test-memory-2026: runs-on: self-hosted steps: - uses: actions/checkout@v4 - name: Run "file" on JPGs via Debian (inside Docker) shell: powershell run: | - # Chemin du repo (converti en / pour Docker) - $work = "${env:GITHUB_WORKSPACE}".Replace('\','/') - docker run --rm -v "$work:/work" -w /work debian:stable-slim bash -lc ' + # Chemin du repo pour Docker (slashes Unix) + $work = $env:GITHUB_WORKSPACE -replace '\\','/' + + # Lance Debian et exécute 'file' sur tous les JPG/JPEG + docker run --rm --mount "type=bind,src=$work,dst=/work" -w /work debian:stable-slim bash -lc @' set -e - apt-get update >/dev/null && apt-get install -y file >/dev/null + apt-get update >/dev/null + apt-get install -y file findutils >/dev/null count=$(find . -type f \( -iname "*.jpg" -o -iname "*.jpeg" \) | wc -l) if [ "$count" -eq 0 ]; then echo "Aucun .jpg/.jpeg"; exit 0; fi find . -type f \( -iname "*.jpg" -o -iname "*.jpeg" \) -print0 | xargs -0 file - ' + '@ + # 4.2 — BUILD : construire l'image /memory-2026:latest build-memory-2026: From 43624cdd4775b348497398289620148c4ef9f9e7 Mon Sep 17 00:00:00 2001 From: maneaGauthier Date: Wed, 1 Oct 2025 11:27:33 +0200 Subject: [PATCH 14/30] fix --- .github/workflows/memory.yml | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/.github/workflows/memory.yml b/.github/workflows/memory.yml index 7cf92b6..2ae667f 100644 --- a/.github/workflows/memory.yml +++ b/.github/workflows/memory.yml @@ -6,7 +6,7 @@ on: jobs: # 4.1 — TEST : exécuter "file" sur tous les JPG/JPEG - test-memory-2026: + test-memory-2026: runs-on: self-hosted steps: - uses: actions/checkout@v4 @@ -26,7 +26,6 @@ jobs: find . -type f \( -iname "*.jpg" -o -iname "*.jpeg" \) -print0 | xargs -0 file '@ - # 4.2 — BUILD : construire l'image /memory-2026:latest build-memory-2026: runs-on: self-hosted @@ -34,7 +33,7 @@ jobs: steps: - uses: actions/checkout@v4 - name: Docker build - run: docker build -t $env:DOCKERHUB_USERNAME/memory-2026:latest . + run: docker build -t ${{ secrets.DOCKERHUB_USERNAME }}/memory-2026:latest . # 4.3 — PUSH : pousser sur Docker Hub push-memory-2026: @@ -42,8 +41,12 @@ jobs: needs: build-memory-2026 steps: - name: Docker login + env: + DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }} + DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }} + shell: powershell run: | - "${{ secrets.DOCKERHUB_TOKEN }}" | docker login -u "${{ secrets.DOCKERHUB_USERNAME }}" --password-stdin + echo $env:DOCKERHUB_TOKEN | docker login -u $env:DOCKERHUB_USERNAME --password-stdin - name: Docker push run: docker push ${{ secrets.DOCKERHUB_USERNAME }}/memory-2026:latest @@ -68,6 +71,6 @@ jobs: DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }} run: | $image = "$env:DOCKERHUB_USERNAME/memory-2026:latest" - # $null doit rester côté machine distante → on échappe $ en `$ + # attention à `$null` côté distant → on l'échappe $remote = "docker pull $image; docker stop memory-2026 *> `$null; docker rm memory-2026 *> `$null; docker run -d --name memory-2026 -p 80:80 $image" ssh -o StrictHostKeyChecking=no "$env:SSH_USER@$env:SSH_HOST" "$remote" From 19501c85bf6afee59f355c791f55a407f5fcd7b8 Mon Sep 17 00:00:00 2001 From: maneaGauthier Date: Wed, 1 Oct 2025 11:31:02 +0200 Subject: [PATCH 15/30] fix --- .github/workflows/memory.yml | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/.github/workflows/memory.yml b/.github/workflows/memory.yml index 2ae667f..ebad4ac 100644 --- a/.github/workflows/memory.yml +++ b/.github/workflows/memory.yml @@ -5,7 +5,6 @@ on: branches: [develop] jobs: - # 4.1 — TEST : exécuter "file" sur tous les JPG/JPEG test-memory-2026: runs-on: self-hosted steps: @@ -16,16 +15,14 @@ jobs: # Chemin du repo pour Docker (slashes Unix) $work = $env:GITHUB_WORKSPACE -replace '\\','/' - # Lance Debian et exécute 'file' sur tous les JPG/JPEG - docker run --rm --mount "type=bind,src=$work,dst=/work" -w /work debian:stable-slim bash -lc @' - set -e - apt-get update >/dev/null - apt-get install -y file findutils >/dev/null - count=$(find . -type f \( -iname "*.jpg" -o -iname "*.jpeg" \) | wc -l) - if [ "$count" -eq 0 ]; then echo "Aucun .jpg/.jpeg"; exit 0; fi + docker run --rm --mount "type=bind,src=$work,dst=/work" -w /work debian:stable-slim bash -lc ' + set -e; export DEBIAN_FRONTEND=noninteractive; + apt-get update >/dev/null && apt-get install -y file findutils >/dev/null; + count=$(find . -type f \( -iname "*.jpg" -o -iname "*.jpeg" \) | wc -l); + if [ "$count" -eq 0 ]; then echo "Aucun .jpg/.jpeg"; exit 0; fi; find . -type f \( -iname "*.jpg" -o -iname "*.jpeg" \) -print0 | xargs -0 file - '@ - + ' + # 4.2 — BUILD : construire l'image /memory-2026:latest build-memory-2026: runs-on: self-hosted From f309caf03f9e91749264ced314d00912b95e5558 Mon Sep 17 00:00:00 2001 From: maneaGauthier Date: Wed, 1 Oct 2025 11:36:00 +0200 Subject: [PATCH 16/30] fix --- .github/workflows/memory.yml | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/.github/workflows/memory.yml b/.github/workflows/memory.yml index ebad4ac..a3571ed 100644 --- a/.github/workflows/memory.yml +++ b/.github/workflows/memory.yml @@ -5,23 +5,21 @@ on: branches: [develop] jobs: - test-memory-2026: + test-memory-2026: runs-on: self-hosted steps: - uses: actions/checkout@v4 - name: Run "file" on JPGs via Debian (inside Docker) shell: powershell run: | - # Chemin du repo pour Docker (slashes Unix) + $work = $env:GITHUB_WORKSPACE -replace '\\','/' - docker run --rm --mount "type=bind,src=$work,dst=/work" -w /work debian:stable-slim bash -lc ' - set -e; export DEBIAN_FRONTEND=noninteractive; - apt-get update >/dev/null && apt-get install -y file findutils >/dev/null; - count=$(find . -type f \( -iname "*.jpg" -o -iname "*.jpeg" \) | wc -l); - if [ "$count" -eq 0 ]; then echo "Aucun .jpg/.jpeg"; exit 0; fi; - find . -type f \( -iname "*.jpg" -o -iname "*.jpeg" \) -print0 | xargs -0 file - ' + + $cmd = 'set -e; export DEBIAN_FRONTEND=noninteractive; apt-get update >/dev/null && apt-get install -y file findutils >/dev/null; count=$(find . -type f \( -iname "*.jpg" -o -iname "*.jpeg" \) | wc -l); if [ "$count" -eq 0 ]; then echo "Aucun .jpg/.jpeg"; exit 0; fi; find . -type f \( -iname "*.jpg" -o -iname "*.jpeg" \) -print0 | xargs -0 file' + + docker run --rm --mount "type=bind,src=$work,dst=/work" -w /work debian:stable-slim bash -lc $cmd + # 4.2 — BUILD : construire l'image /memory-2026:latest build-memory-2026: From 4c6c8f28d1a260868d53ad91ca4eaacf44cbf1f7 Mon Sep 17 00:00:00 2001 From: maneaGauthier Date: Wed, 1 Oct 2025 11:38:30 +0200 Subject: [PATCH 17/30] fix --- .github/workflows/memory.yml | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/.github/workflows/memory.yml b/.github/workflows/memory.yml index a3571ed..671a5a8 100644 --- a/.github/workflows/memory.yml +++ b/.github/workflows/memory.yml @@ -5,22 +5,22 @@ on: branches: [develop] jobs: - test-memory-2026: + # 4.1 — TEST : exécuter "file" sur tous les JPG/JPEG + test-memory-2026: runs-on: self-hosted steps: - uses: actions/checkout@v4 - name: Run "file" on JPGs via Debian (inside Docker) shell: powershell run: | - + # Chemin du repo pour Docker (slashes Unix) $work = $env:GITHUB_WORKSPACE -replace '\\','/' - + # Script bash en UNE SEULE LIGNE (évite les CRLF côté Windows) $cmd = 'set -e; export DEBIAN_FRONTEND=noninteractive; apt-get update >/dev/null && apt-get install -y file findutils >/dev/null; count=$(find . -type f \( -iname "*.jpg" -o -iname "*.jpeg" \) | wc -l); if [ "$count" -eq 0 ]; then echo "Aucun .jpg/.jpeg"; exit 0; fi; find . -type f \( -iname "*.jpg" -o -iname "*.jpeg" \) -print0 | xargs -0 file' docker run --rm --mount "type=bind,src=$work,dst=/work" -w /work debian:stable-slim bash -lc $cmd - # 4.2 — BUILD : construire l'image /memory-2026:latest build-memory-2026: runs-on: self-hosted @@ -28,6 +28,7 @@ jobs: steps: - uses: actions/checkout@v4 - name: Docker build + shell: powershell run: docker build -t ${{ secrets.DOCKERHUB_USERNAME }}/memory-2026:latest . # 4.3 — PUSH : pousser sur Docker Hub @@ -36,13 +37,14 @@ jobs: needs: build-memory-2026 steps: - name: Docker login + shell: powershell env: DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }} DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }} - shell: powershell run: | echo $env:DOCKERHUB_TOKEN | docker login -u $env:DOCKERHUB_USERNAME --password-stdin - name: Docker push + shell: powershell run: docker push ${{ secrets.DOCKERHUB_USERNAME }}/memory-2026:latest # 4.4 — DEPLOY : SSH vers TA machine, pull et run en 80:80 From 5c133deb6a005609c949a9f139b3e7ca2e194435 Mon Sep 17 00:00:00 2001 From: maneaGauthier Date: Wed, 1 Oct 2025 11:39:14 +0200 Subject: [PATCH 18/30] fix --- .github/workflows/memory.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/memory.yml b/.github/workflows/memory.yml index 671a5a8..28e8b9d 100644 --- a/.github/workflows/memory.yml +++ b/.github/workflows/memory.yml @@ -13,10 +13,10 @@ jobs: - name: Run "file" on JPGs via Debian (inside Docker) shell: powershell run: | - # Chemin du repo pour Docker (slashes Unix) + $work = $env:GITHUB_WORKSPACE -replace '\\','/' - # Script bash en UNE SEULE LIGNE (évite les CRLF côté Windows) + $cmd = 'set -e; export DEBIAN_FRONTEND=noninteractive; apt-get update >/dev/null && apt-get install -y file findutils >/dev/null; count=$(find . -type f \( -iname "*.jpg" -o -iname "*.jpeg" \) | wc -l); if [ "$count" -eq 0 ]; then echo "Aucun .jpg/.jpeg"; exit 0; fi; find . -type f \( -iname "*.jpg" -o -iname "*.jpeg" \) -print0 | xargs -0 file' docker run --rm --mount "type=bind,src=$work,dst=/work" -w /work debian:stable-slim bash -lc $cmd From db91ba107685107b1f13af3bee888d02638105e5 Mon Sep 17 00:00:00 2001 From: maneaGauthier Date: Wed, 1 Oct 2025 11:41:42 +0200 Subject: [PATCH 19/30] fix --- .github/workflows/memory.yml | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/.github/workflows/memory.yml b/.github/workflows/memory.yml index 28e8b9d..5235e09 100644 --- a/.github/workflows/memory.yml +++ b/.github/workflows/memory.yml @@ -13,13 +13,19 @@ jobs: - name: Run "file" on JPGs via Debian (inside Docker) shell: powershell run: | - + # 1) Chemin du repo pour Docker (slashes Unix) $work = $env:GITHUB_WORKSPACE -replace '\\','/' - - $cmd = 'set -e; export DEBIAN_FRONTEND=noninteractive; apt-get update >/dev/null && apt-get install -y file findutils >/dev/null; count=$(find . -type f \( -iname "*.jpg" -o -iname "*.jpeg" \) | wc -l); if [ "$count" -eq 0 ]; then echo "Aucun .jpg/.jpeg"; exit 0; fi; find . -type f \( -iname "*.jpg" -o -iname "*.jpeg" \) -print0 | xargs -0 file' + # 2) Script bash (here-string sans interpolation PowerShell) + $cmd = @' +set -e; export DEBIAN_FRONTEND=noninteractive; apt-get update >/dev/null && apt-get install -y file findutils >/dev/null; count=$(find . -type f \( -iname "*.jpg" -o -iname "*.jpeg" \) | wc -l); if [ "$count" -eq 0 ]; then echo "Aucun .jpg/.jpeg"; exit 0; fi; find . -type f \( -iname "*.jpg" -o -iname "*.jpeg" \) -print0 | xargs -0 file +'@ - docker run --rm --mount "type=bind,src=$work,dst=/work" -w /work debian:stable-slim bash -lc $cmd + # 3) Aplatir sur une seule ligne pour éviter les CRLF -> $'\r' not found + $cmd = $cmd -replace "`r","" -replace "`n"," " + + # 4) Exécuter bash -lc **avec l'argument entier entre guillemets** + docker run --rm --mount "type=bind,src=$work,dst=/work" -w /work debian:stable-slim bash -lc "$cmd" # 4.2 — BUILD : construire l'image /memory-2026:latest build-memory-2026: From 4be74a035727882c348cd0488d77a613332968cb Mon Sep 17 00:00:00 2001 From: maneaGauthier Date: Wed, 1 Oct 2025 11:43:33 +0200 Subject: [PATCH 20/30] fix --- .github/workflows/memory.yml | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/.github/workflows/memory.yml b/.github/workflows/memory.yml index 5235e09..b1d0b94 100644 --- a/.github/workflows/memory.yml +++ b/.github/workflows/memory.yml @@ -13,18 +13,13 @@ jobs: - name: Run "file" on JPGs via Debian (inside Docker) shell: powershell run: | - # 1) Chemin du repo pour Docker (slashes Unix) + # Chemin du repo pour Docker (slashes Unix) $work = $env:GITHUB_WORKSPACE -replace '\\','/' - # 2) Script bash (here-string sans interpolation PowerShell) - $cmd = @' -set -e; export DEBIAN_FRONTEND=noninteractive; apt-get update >/dev/null && apt-get install -y file findutils >/dev/null; count=$(find . -type f \( -iname "*.jpg" -o -iname "*.jpeg" \) | wc -l); if [ "$count" -eq 0 ]; then echo "Aucun .jpg/.jpeg"; exit 0; fi; find . -type f \( -iname "*.jpg" -o -iname "*.jpeg" \) -print0 | xargs -0 file -'@ + # Script bash en UNE LIGNE (évite CRLF) + $cmd = 'set -e; export DEBIAN_FRONTEND=noninteractive; apt-get update >/dev/null && apt-get install -y file findutils >/dev/null; count=$(find . -type f \( -iname "*.jpg" -o -iname "*.jpeg" \) | wc -l); if [ "$count" -eq 0 ]; then echo "Aucun .jpg/.jpeg"; exit 0; fi; find . -type f \( -iname "*.jpg" -o -iname "*.jpeg" \) -print0 | xargs -0 file' - # 3) Aplatir sur une seule ligne pour éviter les CRLF -> $'\r' not found - $cmd = $cmd -replace "`r","" -replace "`n"," " - - # 4) Exécuter bash -lc **avec l'argument entier entre guillemets** + # Exécute dans un conteneur Debian docker run --rm --mount "type=bind,src=$work,dst=/work" -w /work debian:stable-slim bash -lc "$cmd" # 4.2 — BUILD : construire l'image /memory-2026:latest From a39d498232c8453d22565130c1f7407225504dee Mon Sep 17 00:00:00 2001 From: maneaGauthier Date: Wed, 1 Oct 2025 11:48:07 +0200 Subject: [PATCH 21/30] fix --- .github/workflows/memory.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/memory.yml b/.github/workflows/memory.yml index b1d0b94..d8fb5a8 100644 --- a/.github/workflows/memory.yml +++ b/.github/workflows/memory.yml @@ -6,6 +6,7 @@ on: jobs: # 4.1 — TEST : exécuter "file" sur tous les JPG/JPEG + # 4.1 — TEST : exécuter "file" sur tous les JPG/JPEG (version robuste Windows) test-memory-2026: runs-on: self-hosted steps: @@ -16,8 +17,8 @@ jobs: # Chemin du repo pour Docker (slashes Unix) $work = $env:GITHUB_WORKSPACE -replace '\\','/' - # Script bash en UNE LIGNE (évite CRLF) - $cmd = 'set -e; export DEBIAN_FRONTEND=noninteractive; apt-get update >/dev/null && apt-get install -y file findutils >/dev/null; count=$(find . -type f \( -iname "*.jpg" -o -iname "*.jpeg" \) | wc -l); if [ "$count" -eq 0 ]; then echo "Aucun .jpg/.jpeg"; exit 0; fi; find . -type f \( -iname "*.jpg" -o -iname "*.jpeg" \) -print0 | xargs -0 file' + # Commande bash sur UNE SEULE LIGNE (pas de CRLF) + $cmd = 'set -e; export DEBIAN_FRONTEND=noninteractive; apt-get update >/dev/null && apt-get install -y file >/dev/null; shopt -s globstar nullglob; files=(**/*.jpg **/*.jpeg); if [ ${#files[@]} -eq 0 ]; then echo "Aucun .jpg/.jpeg"; exit 0; fi; for f in "${files[@]}"; do file "$f"; done' # Exécute dans un conteneur Debian docker run --rm --mount "type=bind,src=$work,dst=/work" -w /work debian:stable-slim bash -lc "$cmd" From adb8e3d9656e95a509bdc9f0f8b7c802a7556009 Mon Sep 17 00:00:00 2001 From: maneaGauthier Date: Wed, 1 Oct 2025 11:53:24 +0200 Subject: [PATCH 22/30] fix --- .github/workflows/memory.yml | 19 +++++-------------- 1 file changed, 5 insertions(+), 14 deletions(-) diff --git a/.github/workflows/memory.yml b/.github/workflows/memory.yml index d8fb5a8..33982fa 100644 --- a/.github/workflows/memory.yml +++ b/.github/workflows/memory.yml @@ -6,23 +6,14 @@ on: jobs: # 4.1 — TEST : exécuter "file" sur tous les JPG/JPEG - # 4.1 — TEST : exécuter "file" sur tous les JPG/JPEG (version robuste Windows) - test-memory-2026: + test-memory-2026: + name: Test Memory 2026 runs-on: self-hosted steps: - - uses: actions/checkout@v4 - - name: Run "file" on JPGs via Debian (inside Docker) - shell: powershell - run: | - # Chemin du repo pour Docker (slashes Unix) - $work = $env:GITHUB_WORKSPACE -replace '\\','/' - - # Commande bash sur UNE SEULE LIGNE (pas de CRLF) - $cmd = 'set -e; export DEBIAN_FRONTEND=noninteractive; apt-get update >/dev/null && apt-get install -y file >/dev/null; shopt -s globstar nullglob; files=(**/*.jpg **/*.jpeg); if [ ${#files[@]} -eq 0 ]; then echo "Aucun .jpg/.jpeg"; exit 0; fi; for f in "${files[@]}"; do file "$f"; done' - - # Exécute dans un conteneur Debian - docker run --rm --mount "type=bind,src=$work,dst=/work" -w /work debian:stable-slim bash -lc "$cmd" + - uses: actions/checkout@v3 + - name: Test all JPEG files + run: file --mime-type ./html/**/*.jpg | grep -v image/jpeg && exit 1 || exit 0 # 4.2 — BUILD : construire l'image /memory-2026:latest build-memory-2026: runs-on: self-hosted From 0c81ebc94a69a68c524b9b59c86a4374c9a5ac7d Mon Sep 17 00:00:00 2001 From: maneaGauthier Date: Wed, 1 Oct 2025 11:54:50 +0200 Subject: [PATCH 23/30] fix --- .github/workflows/memory.yml | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/.github/workflows/memory.yml b/.github/workflows/memory.yml index 33982fa..b10fe11 100644 --- a/.github/workflows/memory.yml +++ b/.github/workflows/memory.yml @@ -1,19 +1,17 @@ name: memory-2026 - on: push: branches: [develop] - jobs: # 4.1 — TEST : exécuter "file" sur tous les JPG/JPEG - test-memory-2026: + test-memory-2026: name: Test Memory 2026 runs-on: self-hosted steps: - uses: actions/checkout@v3 - - name: Test all JPEG files - run: file --mime-type ./html/**/*.jpg | grep -v image/jpeg && exit 1 || exit 0 + run: file --mime-type ./html/**/*.jpg | grep -v "image/jpeg" && exit 1 || exit 0 + # 4.2 — BUILD : construire l'image /memory-2026:latest build-memory-2026: runs-on: self-hosted From cfd7b794e5eb287f779055e232417be7704b01d3 Mon Sep 17 00:00:00 2001 From: maneaGauthier Date: Wed, 1 Oct 2025 11:55:32 +0200 Subject: [PATCH 24/30] fix --- .github/workflows/memory.yml | 46 +++++++++++++++++++++++++++++------- 1 file changed, 38 insertions(+), 8 deletions(-) diff --git a/.github/workflows/memory.yml b/.github/workflows/memory.yml index b10fe11..b0ac3c2 100644 --- a/.github/workflows/memory.yml +++ b/.github/workflows/memory.yml @@ -1,16 +1,45 @@ name: memory-2026 + on: push: branches: [develop] + jobs: # 4.1 — TEST : exécuter "file" sur tous les JPG/JPEG test-memory-2026: - name: Test Memory 2026 runs-on: self-hosted steps: - - uses: actions/checkout@v3 - - name: Test all JPEG files - run: file --mime-type ./html/**/*.jpg | grep -v "image/jpeg" && exit 1 || exit 0 + - uses: actions/checkout@v4 + + # On écrit un script bash (LF uniquement) puis on l'exécute dans Debian + - name: Create test script (LF only) + shell: powershell + run: | + $script = @' +#!/usr/bin/env bash +set -euo pipefail +export DEBIAN_FRONTEND=noninteractive +apt-get update >/dev/null +apt-get install -y file findutils >/dev/null +shopt -s globstar nullglob +files=(**/*.jpg **/*.jpeg) +if [ ${#files[@]} -eq 0 ]; then + echo "Aucun .jpg/.jpeg" + exit 0 +fi +for f in "${files[@]}"; do + file "$f" +done +'@ + $script = $script -replace "`r","" # enlève CR pour éviter ^M + $path = Join-Path $env:GITHUB_WORKSPACE "test_jpgs.sh" + [System.IO.File]::WriteAllText($path, $script, (New-Object System.Text.UTF8Encoding($false))) + + - name: Run test script inside Debian (with 'file') + shell: powershell + run: | + $work = $env:GITHUB_WORKSPACE -replace '\\','/' + docker run --rm --mount "type=bind,src=$work,dst=/work" -w /work debian:stable-slim bash /work/test_jpgs.sh # 4.2 — BUILD : construire l'image /memory-2026:latest build-memory-2026: @@ -38,7 +67,7 @@ jobs: shell: powershell run: docker push ${{ secrets.DOCKERHUB_USERNAME }}/memory-2026:latest - # 4.4 — DEPLOY : SSH vers TA machine, pull et run en 80:80 + # 4.4 — DEPLOY : SSH vers ta machine, pull & run en 80:80 deploy-memory-2026: runs-on: self-hosted needs: push-memory-2026 @@ -51,6 +80,7 @@ jobs: New-Item -ItemType Directory -Force "$HOME\.ssh" | Out-Null Set-Content -Path "$HOME\.ssh\id_rsa" -Value $env:SSH_PRIVATE_KEY -NoNewline icacls "$HOME\.ssh\id_rsa" /inheritance:r /grant:r "$env:USERNAME:(R)" | Out-Null + - name: Deploy to target via SSH shell: powershell env: @@ -58,7 +88,7 @@ jobs: SSH_HOST: ${{ secrets.SSH_HOST }} DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }} run: | - $image = "$env:DOCKERHUB_USERNAME/memory-2026:latest" - # attention à `$null` côté distant → on l'échappe - $remote = "docker pull $image; docker stop memory-2026 *> `$null; docker rm memory-2026 *> `$null; docker run -d --name memory-2026 -p 80:80 $image" + $image = "$env:DOCKERHUB_USERNAME/memory-2026:latest" + # commande PowerShell robuste côté distant : supprime l'ancien conteneur s'il existe puis lance le nouveau + $remote = "docker pull $image; docker ps -aq -f name=^memory-2026$ | % { docker rm -f `$_ }; docker run -d --name memory-2026 -p 80:80 $image" ssh -o StrictHostKeyChecking=no "$env:SSH_USER@$env:SSH_HOST" "$remote" From 2957d2fa50841082eec45bd5a6df237ede1b5d64 Mon Sep 17 00:00:00 2001 From: maneaGauthier Date: Wed, 1 Oct 2025 11:58:04 +0200 Subject: [PATCH 25/30] fix --- .github/workflows/memory.yml | 42 +++++++++++++++++------------------- 1 file changed, 20 insertions(+), 22 deletions(-) diff --git a/.github/workflows/memory.yml b/.github/workflows/memory.yml index b0ac3c2..817f112 100644 --- a/.github/workflows/memory.yml +++ b/.github/workflows/memory.yml @@ -11,31 +11,30 @@ jobs: steps: - uses: actions/checkout@v4 - # On écrit un script bash (LF uniquement) puis on l'exécute dans Debian - name: Create test script (LF only) shell: powershell run: | - $script = @' -#!/usr/bin/env bash -set -euo pipefail -export DEBIAN_FRONTEND=noninteractive -apt-get update >/dev/null -apt-get install -y file findutils >/dev/null -shopt -s globstar nullglob -files=(**/*.jpg **/*.jpeg) -if [ ${#files[@]} -eq 0 ]; then - echo "Aucun .jpg/.jpeg" - exit 0 -fi -for f in "${files[@]}"; do - file "$f" -done -'@ - $script = $script -replace "`r","" # enlève CR pour éviter ^M - $path = Join-Path $env:GITHUB_WORKSPACE "test_jpgs.sh" - [System.IO.File]::WriteAllText($path, $script, (New-Object System.Text.UTF8Encoding($false))) + $lines = @( + '#!/usr/bin/env bash' + 'set -euo pipefail' + 'export DEBIAN_FRONTEND=noninteractive' + 'apt-get update >/dev/null' + 'apt-get install -y file >/dev/null' + 'shopt -s globstar nullglob' + 'files=(**/*.jpg **/*.jpeg)' + 'if [ ${#files[@]} -eq 0 ]; then' + ' echo "Aucun .jpg/.jpeg"' + ' exit 0' + 'fi' + 'for f in "${files[@]}"; do' + ' file "$f"' + 'done' + ) + $path = Join-Path $env:GITHUB_WORKSPACE 'test_jpgs.sh' + $content = ($lines -join "`n") # LF uniquement + [System.IO.File]::WriteAllText($path, $content, (New-Object System.Text.UTF8Encoding($false))) - - name: Run test script inside Debian (with 'file') + - name: Run test script inside Debian (with "file") shell: powershell run: | $work = $env:GITHUB_WORKSPACE -replace '\\','/' @@ -89,6 +88,5 @@ done DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }} run: | $image = "$env:DOCKERHUB_USERNAME/memory-2026:latest" - # commande PowerShell robuste côté distant : supprime l'ancien conteneur s'il existe puis lance le nouveau $remote = "docker pull $image; docker ps -aq -f name=^memory-2026$ | % { docker rm -f `$_ }; docker run -d --name memory-2026 -p 80:80 $image" ssh -o StrictHostKeyChecking=no "$env:SSH_USER@$env:SSH_HOST" "$remote" From d69906108fd3aae6be85336409de40d2227faa4b Mon Sep 17 00:00:00 2001 From: maneaGauthier Date: Wed, 1 Oct 2025 12:21:52 +0200 Subject: [PATCH 26/30] fix --- .github/workflows/memory.yml | 40 ++++++++++++++++++++++++------------ 1 file changed, 27 insertions(+), 13 deletions(-) diff --git a/.github/workflows/memory.yml b/.github/workflows/memory.yml index 817f112..c40d33f 100644 --- a/.github/workflows/memory.yml +++ b/.github/workflows/memory.yml @@ -52,19 +52,33 @@ jobs: # 4.3 — PUSH : pousser sur Docker Hub push-memory-2026: - runs-on: self-hosted - needs: build-memory-2026 - steps: - - name: Docker login - shell: powershell - env: - DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }} - DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }} - run: | - echo $env:DOCKERHUB_TOKEN | docker login -u $env:DOCKERHUB_USERNAME --password-stdin - - name: Docker push - shell: powershell - run: docker push ${{ secrets.DOCKERHUB_USERNAME }}/memory-2026:latest + runs-on: self-hosted + needs: build-memory-2026 + steps: + - name: Sanity check secrets + shell: powershell + run: | + if (-not "${{ secrets.DOCKERHUB_USERNAME }}") { throw "Secret DOCKERHUB_USERNAME vide ou manquant" } + if (-not "${{ secrets.DOCKERHUB_TOKEN }}") { throw "Secret DOCKERHUB_TOKEN vide ou manquant" } + Write-Host "Secrets présents ✅" + + - name: Docker login (robuste, via fichier ASCII) + shell: powershell + run: | + $u = "${{ secrets.DOCKERHUB_USERNAME }}".Trim().ToLower() + $t = "${{ secrets.DOCKERHUB_TOKEN }}".Trim() + $file = Join-Path $env:RUNNER_TEMP "dh_token.txt" + [System.IO.File]::WriteAllText($file, $t, [System.Text.Encoding]::ASCII) + docker logout 2>$null + docker login -u $u --password-stdin < $file + Remove-Item $file -Force + docker info | Select-String -SimpleMatch "Username: $u" | Out-Host + + - name: Docker push + shell: powershell + run: | + $u = "${{ secrets.DOCKERHUB_USERNAME }}".Trim().ToLower() + docker push "$u/memory-2026:latest" # 4.4 — DEPLOY : SSH vers ta machine, pull & run en 80:80 deploy-memory-2026: From 7969be8f3fca6009755557d802c1b0a10b6cfbc3 Mon Sep 17 00:00:00 2001 From: maneaGauthier Date: Wed, 1 Oct 2025 12:22:32 +0200 Subject: [PATCH 27/30] fix --- .github/workflows/memory.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/memory.yml b/.github/workflows/memory.yml index c40d33f..73d3517 100644 --- a/.github/workflows/memory.yml +++ b/.github/workflows/memory.yml @@ -60,7 +60,7 @@ jobs: run: | if (-not "${{ secrets.DOCKERHUB_USERNAME }}") { throw "Secret DOCKERHUB_USERNAME vide ou manquant" } if (-not "${{ secrets.DOCKERHUB_TOKEN }}") { throw "Secret DOCKERHUB_TOKEN vide ou manquant" } - Write-Host "Secrets présents ✅" + Write-Host "Secrets présents" - name: Docker login (robuste, via fichier ASCII) shell: powershell From 4d5666dc47c602b69990094e297ee701cdbff289 Mon Sep 17 00:00:00 2001 From: maneaGauthier Date: Wed, 1 Oct 2025 12:24:29 +0200 Subject: [PATCH 28/30] fix --- .github/workflows/memory.yml | 52 ++++++++++++++++++------------------ 1 file changed, 26 insertions(+), 26 deletions(-) diff --git a/.github/workflows/memory.yml b/.github/workflows/memory.yml index 73d3517..5feaf3c 100644 --- a/.github/workflows/memory.yml +++ b/.github/workflows/memory.yml @@ -31,7 +31,7 @@ jobs: 'done' ) $path = Join-Path $env:GITHUB_WORKSPACE 'test_jpgs.sh' - $content = ($lines -join "`n") # LF uniquement + $content = ($lines -join "`n") # LF uniquement [System.IO.File]::WriteAllText($path, $content, (New-Object System.Text.UTF8Encoding($false))) - name: Run test script inside Debian (with "file") @@ -52,33 +52,33 @@ jobs: # 4.3 — PUSH : pousser sur Docker Hub push-memory-2026: - runs-on: self-hosted - needs: build-memory-2026 - steps: - - name: Sanity check secrets - shell: powershell - run: | - if (-not "${{ secrets.DOCKERHUB_USERNAME }}") { throw "Secret DOCKERHUB_USERNAME vide ou manquant" } - if (-not "${{ secrets.DOCKERHUB_TOKEN }}") { throw "Secret DOCKERHUB_TOKEN vide ou manquant" } - Write-Host "Secrets présents" + runs-on: self-hosted + needs: build-memory-2026 + steps: + - name: Sanity check secrets + shell: powershell + run: | + if (-not "${{ secrets.DOCKERHUB_USERNAME }}") { throw "Secret DOCKERHUB_USERNAME vide ou manquant" } + if (-not "${{ secrets.DOCKERHUB_TOKEN }}") { throw "Secret DOCKERHUB_TOKEN vide ou manquant" } + Write-Host "Secrets présents " - - name: Docker login (robuste, via fichier ASCII) - shell: powershell - run: | - $u = "${{ secrets.DOCKERHUB_USERNAME }}".Trim().ToLower() - $t = "${{ secrets.DOCKERHUB_TOKEN }}".Trim() - $file = Join-Path $env:RUNNER_TEMP "dh_token.txt" - [System.IO.File]::WriteAllText($file, $t, [System.Text.Encoding]::ASCII) - docker logout 2>$null - docker login -u $u --password-stdin < $file - Remove-Item $file -Force - docker info | Select-String -SimpleMatch "Username: $u" | Out-Host + - name: Docker login (robuste, via fichier ASCII) + shell: powershell + run: | + $u = "${{ secrets.DOCKERHUB_USERNAME }}".Trim().ToLower() + $t = "${{ secrets.DOCKERHUB_TOKEN }}".Trim() + $file = Join-Path $env:RUNNER_TEMP "dh_token.txt" + [System.IO.File]::WriteAllText($file, $t, [System.Text.Encoding]::ASCII) + docker logout 2>$null + docker login -u $u --password-stdin < $file + Remove-Item $file -Force + docker info | Select-String -SimpleMatch "Username: $u" | Out-Host - - name: Docker push - shell: powershell - run: | - $u = "${{ secrets.DOCKERHUB_USERNAME }}".Trim().ToLower() - docker push "$u/memory-2026:latest" + - name: Docker push + shell: powershell + run: | + $u = "${{ secrets.DOCKERHUB_USERNAME }}".Trim().ToLower() + docker push "$u/memory-2026:latest" # 4.4 — DEPLOY : SSH vers ta machine, pull & run en 80:80 deploy-memory-2026: From 141d769e5f8f66abbad73ef4dfab02daaeabd688 Mon Sep 17 00:00:00 2001 From: maneaGauthier Date: Wed, 1 Oct 2025 12:26:48 +0200 Subject: [PATCH 29/30] fix --- .github/workflows/memory.yml | 51 ++++++++++++++++++------------------ 1 file changed, 26 insertions(+), 25 deletions(-) diff --git a/.github/workflows/memory.yml b/.github/workflows/memory.yml index 5feaf3c..eb619ea 100644 --- a/.github/workflows/memory.yml +++ b/.github/workflows/memory.yml @@ -52,33 +52,34 @@ jobs: # 4.3 — PUSH : pousser sur Docker Hub push-memory-2026: - runs-on: self-hosted - needs: build-memory-2026 - steps: - - name: Sanity check secrets - shell: powershell - run: | - if (-not "${{ secrets.DOCKERHUB_USERNAME }}") { throw "Secret DOCKERHUB_USERNAME vide ou manquant" } - if (-not "${{ secrets.DOCKERHUB_TOKEN }}") { throw "Secret DOCKERHUB_TOKEN vide ou manquant" } - Write-Host "Secrets présents " + runs-on: self-hosted + needs: build-memory-2026 + steps: + - name: Sanity check secrets + shell: powershell + run: | + if (-not "${{ secrets.DOCKERHUB_USERNAME }}") { throw "Secret DOCKERHUB_USERNAME vide ou manquant" } + if (-not "${{ secrets.DOCKERHUB_TOKEN }}") { throw "Secret DOCKERHUB_TOKEN vide ou manquant" } + Write-Host "Secrets présents " - - name: Docker login (robuste, via fichier ASCII) - shell: powershell - run: | - $u = "${{ secrets.DOCKERHUB_USERNAME }}".Trim().ToLower() - $t = "${{ secrets.DOCKERHUB_TOKEN }}".Trim() - $file = Join-Path $env:RUNNER_TEMP "dh_token.txt" - [System.IO.File]::WriteAllText($file, $t, [System.Text.Encoding]::ASCII) - docker logout 2>$null - docker login -u $u --password-stdin < $file - Remove-Item $file -Force - docker info | Select-String -SimpleMatch "Username: $u" | Out-Host + - name: Docker login (via cmd + fichier ASCII) + shell: powershell + run: | + $u = "${{ secrets.DOCKERHUB_USERNAME }}".Trim().ToLower() + $t = "${{ secrets.DOCKERHUB_TOKEN }}".Trim() + $tf = Join-Path $env:RUNNER_TEMP "dh_token.txt" + [System.IO.File]::WriteAllText($tf, $t, [System.Text.Encoding]::ASCII) + # on utilise cmd.exe pour interpréter la redirection "<" + cmd /c "docker logout 1>nul 2>nul & docker login -u $u --password-stdin < ""$tf""" + Remove-Item $tf -Force + docker info | Select-String -SimpleMatch "Username: $u" | Out-Host + + - name: Docker push + shell: powershell + run: | + $u = "${{ secrets.DOCKERHUB_USERNAME }}".Trim().ToLower() + docker push "$u/memory-2026:latest" - - name: Docker push - shell: powershell - run: | - $u = "${{ secrets.DOCKERHUB_USERNAME }}".Trim().ToLower() - docker push "$u/memory-2026:latest" # 4.4 — DEPLOY : SSH vers ta machine, pull & run en 80:80 deploy-memory-2026: From 29259f39a84305564004b7ce691a9292b8110f94 Mon Sep 17 00:00:00 2001 From: maneaGauthier Date: Wed, 1 Oct 2025 12:28:59 +0200 Subject: [PATCH 30/30] fix --- .github/workflows/memory.yml | 86 ++++++++++++++++-------------------- 1 file changed, 39 insertions(+), 47 deletions(-) diff --git a/.github/workflows/memory.yml b/.github/workflows/memory.yml index eb619ea..db5ca94 100644 --- a/.github/workflows/memory.yml +++ b/.github/workflows/memory.yml @@ -1,39 +1,35 @@ name: memory-2026 - on: push: branches: [develop] - jobs: # 4.1 — TEST : exécuter "file" sur tous les JPG/JPEG test-memory-2026: runs-on: self-hosted steps: - uses: actions/checkout@v4 - - name: Create test script (LF only) shell: powershell run: | $lines = @( - '#!/usr/bin/env bash' - 'set -euo pipefail' - 'export DEBIAN_FRONTEND=noninteractive' - 'apt-get update >/dev/null' - 'apt-get install -y file >/dev/null' - 'shopt -s globstar nullglob' - 'files=(**/*.jpg **/*.jpeg)' - 'if [ ${#files[@]} -eq 0 ]; then' - ' echo "Aucun .jpg/.jpeg"' - ' exit 0' - 'fi' - 'for f in "${files[@]}"; do' - ' file "$f"' + '#!/usr/bin/env bash', + 'set -euo pipefail', + 'export DEBIAN_FRONTEND=noninteractive', + 'apt-get update >/dev/null', + 'apt-get install -y file >/dev/null', + 'shopt -s globstar nullglob', + 'files=(**/*.jpg **/*.jpeg)', + 'if [ ${#files[@]} -eq 0 ]; then', + ' echo "Aucun .jpg/.jpeg"', + ' exit 0', + 'fi', + 'for f in "${files[@]}"; do', + ' file "$f"', 'done' ) $path = Join-Path $env:GITHUB_WORKSPACE 'test_jpgs.sh' $content = ($lines -join "`n") # LF uniquement [System.IO.File]::WriteAllText($path, $content, (New-Object System.Text.UTF8Encoding($false))) - - name: Run test script inside Debian (with "file") shell: powershell run: | @@ -52,34 +48,31 @@ jobs: # 4.3 — PUSH : pousser sur Docker Hub push-memory-2026: - runs-on: self-hosted - needs: build-memory-2026 - steps: - - name: Sanity check secrets - shell: powershell - run: | - if (-not "${{ secrets.DOCKERHUB_USERNAME }}") { throw "Secret DOCKERHUB_USERNAME vide ou manquant" } - if (-not "${{ secrets.DOCKERHUB_TOKEN }}") { throw "Secret DOCKERHUB_TOKEN vide ou manquant" } - Write-Host "Secrets présents " - - - name: Docker login (via cmd + fichier ASCII) - shell: powershell - run: | - $u = "${{ secrets.DOCKERHUB_USERNAME }}".Trim().ToLower() - $t = "${{ secrets.DOCKERHUB_TOKEN }}".Trim() - $tf = Join-Path $env:RUNNER_TEMP "dh_token.txt" - [System.IO.File]::WriteAllText($tf, $t, [System.Text.Encoding]::ASCII) - # on utilise cmd.exe pour interpréter la redirection "<" - cmd /c "docker logout 1>nul 2>nul & docker login -u $u --password-stdin < ""$tf""" - Remove-Item $tf -Force - docker info | Select-String -SimpleMatch "Username: $u" | Out-Host - - - name: Docker push - shell: powershell - run: | - $u = "${{ secrets.DOCKERHUB_USERNAME }}".Trim().ToLower() - docker push "$u/memory-2026:latest" - + runs-on: self-hosted + needs: build-memory-2026 + steps: + - name: Sanity check secrets + shell: powershell + run: | + if (-not "${{ secrets.DOCKERHUB_USERNAME }}") { throw "Secret DOCKERHUB_USERNAME vide ou manquant" } + if (-not "${{ secrets.DOCKERHUB_TOKEN }}") { throw "Secret DOCKERHUB_TOKEN vide ou manquant" } + Write-Host "Secrets présents" + - name: Docker login (via cmd + fichier ASCII) + shell: powershell + run: | + $u = "${{ secrets.DOCKERHUB_USERNAME }}".Trim().ToLower() + $t = "${{ secrets.DOCKERHUB_TOKEN }}".Trim() + $tf = Join-Path $env:RUNNER_TEMP "dh_token.txt" + [System.IO.File]::WriteAllText($tf, $t, [System.Text.Encoding]::ASCII) + # on utilise cmd.exe pour interpréter la redirection "<" + cmd /c "docker logout 1>nul 2>nul & docker login -u $u --password-stdin < ""$tf""" + Remove-Item $tf -Force + docker info | Select-String -SimpleMatch "Username: $u" | Out-Host + - name: Docker push + shell: powershell + run: | + $u = "${{ secrets.DOCKERHUB_USERNAME }}".Trim().ToLower() + docker push "$u/memory-2026:latest" # 4.4 — DEPLOY : SSH vers ta machine, pull & run en 80:80 deploy-memory-2026: @@ -94,7 +87,6 @@ jobs: New-Item -ItemType Directory -Force "$HOME\.ssh" | Out-Null Set-Content -Path "$HOME\.ssh\id_rsa" -Value $env:SSH_PRIVATE_KEY -NoNewline icacls "$HOME\.ssh\id_rsa" /inheritance:r /grant:r "$env:USERNAME:(R)" | Out-Null - - name: Deploy to target via SSH shell: powershell env: @@ -103,5 +95,5 @@ jobs: DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }} run: | $image = "$env:DOCKERHUB_USERNAME/memory-2026:latest" - $remote = "docker pull $image; docker ps -aq -f name=^memory-2026$ | % { docker rm -f `$_ }; docker run -d --name memory-2026 -p 80:80 $image" + $remote = "docker pull $image; docker ps -aq -f name=^memory-2026$ | xargs -r docker rm -f; docker run -d --name memory-2026 -p 80:80 $image" ssh -o StrictHostKeyChecking=no "$env:SSH_USER@$env:SSH_HOST" "$remote"