From 83392c7ff4415ed6fa7e88b2e8bc8f13c82b12d2 Mon Sep 17 00:00:00 2001 From: ineszang <163989672+ineszang@users.noreply.github.com> Date: Tue, 15 Sep 2026 14:56:33 +0200 Subject: [PATCH 01/20] chore: init pipeline frontend --- .github/workflows/dev-front-pipeline.yml | 53 ++++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 .github/workflows/dev-front-pipeline.yml diff --git a/.github/workflows/dev-front-pipeline.yml b/.github/workflows/dev-front-pipeline.yml new file mode 100644 index 0000000..1912e1a --- /dev/null +++ b/.github/workflows/dev-front-pipeline.yml @@ -0,0 +1,53 @@ +# Pipeline à multiple scénarios +# pour l'environnement de dev + +name: Dev Pipeline (frontend) + +on: + # workflow_dispatch -> lancement manuel des jobs + workflow_dispatch: + inputs: + job_choice: + type: choice + description: "Choix du job" + options: + - build + - test + - deploy + - all + + # push: + # branches: [ "dev" ] + pull_request: + branches: [ "dev" ] + + +jobs: + build: + if: ${{ github.event.inputs.job_choice == 'build' }} + # The type of runner that the job will run on + runs-on: ubuntu-latest + # Steps represent a sequence of tasks that will be executed as part of the job + steps: + # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it + - uses: actions/checkout@v4 + # Runs a single command using the runners shell + - name: Run a one-line script + run: echo Hello, world! + # Runs a set of commands using the runners shell + # - name: Run a multi-line script + # run: | + # echo Add other actions to build, + # echo test, and deploy your project. + + test: + if: ${{ github.event.inputs.job_choice == 'test' }} + runs-on: ubuntu-latest + steps: + - run: echo "TEST job is running" + + deploy: + if: ${{ github.event.inputs.job_choice == 'deploy' }} + runs-on: ubuntu-latest + steps: + - run: echo "DEPLOY job is running" From b8f806518fa7f854677d449f4f32fda047883cfd Mon Sep 17 00:00:00 2001 From: ineszang Date: Tue, 15 Sep 2026 16:08:31 +0200 Subject: [PATCH 02/20] feat(frontend): ajout sonarqube dans le pipeline --- .github/workflows/dev-front-pipeline.yml | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/.github/workflows/dev-front-pipeline.yml b/.github/workflows/dev-front-pipeline.yml index 1912e1a..28abac2 100644 --- a/.github/workflows/dev-front-pipeline.yml +++ b/.github/workflows/dev-front-pipeline.yml @@ -12,6 +12,7 @@ on: description: "Choix du job" options: - build + - sonarqube - test - deploy - all @@ -40,6 +41,18 @@ jobs: # echo Add other actions to build, # echo test, and deploy your project. + sonarqube: + name: SonarQube + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1 + with: + fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis + - name: SonarQube Scan + uses: SonarSource/sonarqube-scan-action@7006c4492b2e0ee0f816d36501671557c97f5995 # v8.1.0 + env: + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + test: if: ${{ github.event.inputs.job_choice == 'test' }} runs-on: ubuntu-latest From b300be5186b7164e66651d3831c8121e93b349b7 Mon Sep 17 00:00:00 2001 From: ineszang Date: Tue, 15 Sep 2026 16:10:18 +0200 Subject: [PATCH 03/20] chore: init de la config du frontend sur docker compose --- docker-compose.yml | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/docker-compose.yml b/docker-compose.yml index d8569c9..1a3983c 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -43,5 +43,18 @@ services: - "${BACKEND_PORT:-8000}:8000" restart: unless-stopped + frontend: + build: ./apps/frontend + # si backend fonctionnel + depends_on: + backend: + condition: service_healthy + environment: + + ports: + - "${FRONTEND_PORT:-3000}:80" + restart: unless-stopped + + volumes: pgdata: From 2390e58f78fae88e028f5b623bb0183046cf9fa1 Mon Sep 17 00:00:00 2001 From: ineszang Date: Tue, 15 Sep 2026 16:10:39 +0200 Subject: [PATCH 04/20] chore: sonarqube --- sonar-project.properties | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 sonar-project.properties diff --git a/sonar-project.properties b/sonar-project.properties new file mode 100644 index 0000000..3c1af86 --- /dev/null +++ b/sonar-project.properties @@ -0,0 +1,14 @@ +sonar.projectKey=ProjetPiscine_EnerVision +sonar.organization=groupe3-ener-vision + + +# This is the name and version displayed in the SonarCloud UI. +#sonar.projectName=ProjetPiscine_EnerVision +#sonar.projectVersion=1.0 + + +# Path is relative to the sonar-project.properties file. Replace "\" by "/" on Windows. +#sonar.sources=. + +# Encoding of the source code. Default is default system encoding +#sonar.sourceEncoding=UTF-8 \ No newline at end of file From ff6e3c288ca467792767a47acad897332276b4f4 Mon Sep 17 00:00:00 2001 From: ineszang Date: Tue, 15 Sep 2026 16:35:50 +0200 Subject: [PATCH 05/20] feat(frontend): ajout du job de build --- .github/workflows/dev-front-pipeline.yml | 47 ++++++++++++------------ 1 file changed, 24 insertions(+), 23 deletions(-) diff --git a/.github/workflows/dev-front-pipeline.yml b/.github/workflows/dev-front-pipeline.yml index 28abac2..17f4010 100644 --- a/.github/workflows/dev-front-pipeline.yml +++ b/.github/workflows/dev-front-pipeline.yml @@ -24,23 +24,6 @@ on: jobs: - build: - if: ${{ github.event.inputs.job_choice == 'build' }} - # The type of runner that the job will run on - runs-on: ubuntu-latest - # Steps represent a sequence of tasks that will be executed as part of the job - steps: - # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it - - uses: actions/checkout@v4 - # Runs a single command using the runners shell - - name: Run a one-line script - run: echo Hello, world! - # Runs a set of commands using the runners shell - # - name: Run a multi-line script - # run: | - # echo Add other actions to build, - # echo test, and deploy your project. - sonarqube: name: SonarQube runs-on: ubuntu-latest @@ -57,10 +40,28 @@ jobs: if: ${{ github.event.inputs.job_choice == 'test' }} runs-on: ubuntu-latest steps: - - run: echo "TEST job is running" + - uses: actions/setup-node@v4 + with: + node-version: 24 + cache: npm + - run: npm ci + - run: npm test -- --watch=false + + # build: + # # si l'utilisateur a choise le job 'build' ou l'ensemble des jobs avec l'option 'all' + # if: ${{ github.event.inputs.job_choice == 'build' || github.event.inputs.job_choice == 'all' }} + # runs-on: ubuntu-latest + # steps: + # - uses: actions/setup-node@v4 + # with: + # node-version: 24 + # cache: npm + + # - run: npm ci + # - run: npm run build - deploy: - if: ${{ github.event.inputs.job_choice == 'deploy' }} - runs-on: ubuntu-latest - steps: - - run: echo "DEPLOY job is running" + # deploy: + # if: ${{ github.event.inputs.job_choice == 'deploy' }} + # runs-on: ubuntu-latest + # steps: + # - run: echo "DEPLOY job is running" From 3ef7de5baac425c0e4088b96819fae275e66bc07 Mon Sep 17 00:00:00 2001 From: ineszang Date: Tue, 15 Sep 2026 16:46:16 +0200 Subject: [PATCH 06/20] feat(frontend): ajout chemins dans le pipeline CI --- .../{dev-front-pipeline.yml => frontend.yml} | 35 +++++++++++-------- 1 file changed, 20 insertions(+), 15 deletions(-) rename .github/workflows/{dev-front-pipeline.yml => frontend.yml} (66%) diff --git a/.github/workflows/dev-front-pipeline.yml b/.github/workflows/frontend.yml similarity index 66% rename from .github/workflows/dev-front-pipeline.yml rename to .github/workflows/frontend.yml index 17f4010..923baa1 100644 --- a/.github/workflows/dev-front-pipeline.yml +++ b/.github/workflows/frontend.yml @@ -16,11 +16,14 @@ on: - test - deploy - all - - # push: - # branches: [ "dev" ] + push: + paths: + - "apps/frontend/**" + - ".github/workflows/dev-front-pipeline.yml" pull_request: - branches: [ "dev" ] + paths: + - "apps/frontend/**" + - ".github/workflows/dev-front-pipeline.yml" jobs: @@ -40,6 +43,7 @@ jobs: if: ${{ github.event.inputs.job_choice == 'test' }} runs-on: ubuntu-latest steps: + - uses: actions/checkout@v4 - uses: actions/setup-node@v4 with: node-version: 24 @@ -47,18 +51,19 @@ jobs: - run: npm ci - run: npm test -- --watch=false - # build: - # # si l'utilisateur a choise le job 'build' ou l'ensemble des jobs avec l'option 'all' - # if: ${{ github.event.inputs.job_choice == 'build' || github.event.inputs.job_choice == 'all' }} - # runs-on: ubuntu-latest - # steps: - # - uses: actions/setup-node@v4 - # with: - # node-version: 24 - # cache: npm + build: + # si l'utilisateur a choise le job 'build' ou l'ensemble des jobs avec l'option 'all' + if: ${{ github.event.inputs.job_choice == 'build' || github.event.inputs.job_choice == 'all' }} + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 + with: + node-version: 24 + cache: npm - # - run: npm ci - # - run: npm run build + - run: npm ci + - run: npm run build # deploy: # if: ${{ github.event.inputs.job_choice == 'deploy' }} From b5cffbf56fa9d9a362e9b10b2243b32ea43e549f Mon Sep 17 00:00:00 2001 From: ineszang Date: Tue, 15 Sep 2026 16:59:34 +0200 Subject: [PATCH 07/20] =?UTF-8?q?fix(frontend):=20changement=20de=20versio?= =?UTF-8?q?n=20des=20actions=20pour=20raisons=20de=20compatibilit=C3=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/frontend.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/frontend.yml b/.github/workflows/frontend.yml index 923baa1..412e1a0 100644 --- a/.github/workflows/frontend.yml +++ b/.github/workflows/frontend.yml @@ -1,7 +1,7 @@ # Pipeline à multiple scénarios # pour l'environnement de dev -name: Dev Pipeline (frontend) +name: Frontend on: # workflow_dispatch -> lancement manuel des jobs @@ -56,8 +56,8 @@ jobs: if: ${{ github.event.inputs.job_choice == 'build' || github.event.inputs.job_choice == 'all' }} runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 - - uses: actions/setup-node@v4 + - uses: actions/checkout@v6 + - uses: actions/setup-node@v6 with: node-version: 24 cache: npm From 61b3494d12ae344a75db72034a012238930cf26c Mon Sep 17 00:00:00 2001 From: ineszang44 Date: Wed, 16 Sep 2026 10:03:59 +0200 Subject: [PATCH 08/20] correction nom du workflow pour le frontend --- .github/workflows/frontend.yml | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/.github/workflows/frontend.yml b/.github/workflows/frontend.yml index 412e1a0..4696599 100644 --- a/.github/workflows/frontend.yml +++ b/.github/workflows/frontend.yml @@ -1,6 +1,3 @@ -# Pipeline à multiple scénarios -# pour l'environnement de dev - name: Frontend on: @@ -19,11 +16,11 @@ on: push: paths: - "apps/frontend/**" - - ".github/workflows/dev-front-pipeline.yml" + - ".github/workflows/frontend.yml" pull_request: paths: - "apps/frontend/**" - - ".github/workflows/dev-front-pipeline.yml" + - ".github/workflows/frontend.yml" jobs: From 11baea7117750757b9e434b2909137c2de9c5cca Mon Sep 17 00:00:00 2001 From: ineszang44 Date: Wed, 16 Sep 2026 10:29:47 +0200 Subject: [PATCH 09/20] =?UTF-8?q?changement=20d'ordre=20des=20jobs=20+=20a?= =?UTF-8?q?jout=20des=20d=C3=A9pendances=20entre=20les=20jobs?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/frontend.yml | 59 ++++++++++++++++++---------------- 1 file changed, 32 insertions(+), 27 deletions(-) diff --git a/.github/workflows/frontend.yml b/.github/workflows/frontend.yml index 4696599..1aa8981 100644 --- a/.github/workflows/frontend.yml +++ b/.github/workflows/frontend.yml @@ -1,4 +1,5 @@ name: Frontend +# Pipeline à choix multiple on: # workflow_dispatch -> lancement manuel des jobs @@ -12,7 +13,7 @@ on: - sonarqube - test - deploy - - all + - all # lancer tous les jobs push: paths: - "apps/frontend/**" @@ -22,34 +23,11 @@ on: - "apps/frontend/**" - ".github/workflows/frontend.yml" +# Ordre de lancement des jobs +# build -> test -> sonarqube -> deploy jobs: - sonarqube: - name: SonarQube - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1 - with: - fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis - - name: SonarQube Scan - uses: SonarSource/sonarqube-scan-action@7006c4492b2e0ee0f816d36501671557c97f5995 # v8.1.0 - env: - SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} - - test: - if: ${{ github.event.inputs.job_choice == 'test' }} - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - uses: actions/setup-node@v4 - with: - node-version: 24 - cache: npm - - run: npm ci - - run: npm test -- --watch=false - build: - # si l'utilisateur a choise le job 'build' ou l'ensemble des jobs avec l'option 'all' if: ${{ github.event.inputs.job_choice == 'build' || github.event.inputs.job_choice == 'all' }} runs-on: ubuntu-latest steps: @@ -61,9 +39,36 @@ jobs: - run: npm ci - run: npm run build + + test: + if: ${{ github.event.inputs.job_choice == 'test' || github.event.inputs.job_choice == 'all' }} + needs: build + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v6 + - uses: actions/setup-node@v6 + with: + node-version: 24 + cache: npm + - run: npm ci + - run: npm test -- --watch=false + + sonarqube: + if: ${{ github.event.inputs.job_choice == 'sonarqube' || github.event.inputs.job_choice == 'all' }} + needs: [build, test] + name: SonarQube + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1 + with: + fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis + - name: SonarQube Scan + uses: SonarSource/sonarqube-scan-action@7006c4492b2e0ee0f816d36501671557c97f5995 # v8.1.0 + env: + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + # deploy: - # if: ${{ github.event.inputs.job_choice == 'deploy' }} # runs-on: ubuntu-latest # steps: # - run: echo "DEPLOY job is running" From 596cf43eda9012708a7bc77242f72cb23ed9de08 Mon Sep 17 00:00:00 2001 From: ineszang44 Date: Wed, 16 Sep 2026 11:22:58 +0200 Subject: [PATCH 10/20] test(frontend): lancement manuel du workflow --- .github/workflows/frontend.yml | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/.github/workflows/frontend.yml b/.github/workflows/frontend.yml index 1aa8981..774d9dc 100644 --- a/.github/workflows/frontend.yml +++ b/.github/workflows/frontend.yml @@ -6,18 +6,15 @@ on: workflow_dispatch: inputs: job_choice: - type: choice + required: true description: "Choix du job" + type: choice + default: all options: - build - sonarqube - test - - deploy - all # lancer tous les jobs - push: - paths: - - "apps/frontend/**" - - ".github/workflows/frontend.yml" pull_request: paths: - "apps/frontend/**" @@ -36,12 +33,15 @@ jobs: with: node-version: 24 cache: npm + cache-dependency-path: apps/frontend/package-lock.json - run: npm ci + working-directory: apps/frontend - run: npm run build + working-directory: apps/frontend test: - if: ${{ github.event.inputs.job_choice == 'test' || github.event.inputs.job_choice == 'all' }} + if: ${{ always() && (github.event.inputs.job_choice == 'test' || github.event.inputs.job_choice == 'all') }} needs: build runs-on: ubuntu-latest steps: @@ -50,11 +50,14 @@ jobs: with: node-version: 24 cache: npm + cache-dependency-path: apps/frontend/package-lock.json - run: npm ci + working-directory: apps/frontend - run: npm test -- --watch=false + working-directory: apps/frontend sonarqube: - if: ${{ github.event.inputs.job_choice == 'sonarqube' || github.event.inputs.job_choice == 'all' }} + if: ${{ always() && (github.event.inputs.job_choice == 'sonarqube' || github.event.inputs.job_choice == 'all') }} needs: [build, test] name: SonarQube runs-on: ubuntu-latest From 078983a41dee32f13e5095c2ff7ab672cb469f48 Mon Sep 17 00:00:00 2001 From: ineszang44 Date: Wed, 16 Sep 2026 11:25:55 +0200 Subject: [PATCH 11/20] =?UTF-8?q?test(frontend):=20suppression=20de=20la?= =?UTF-8?q?=20propri=C3=A9t=C3=A9=20'pull-request'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/frontend.yml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/.github/workflows/frontend.yml b/.github/workflows/frontend.yml index 774d9dc..1cc9af3 100644 --- a/.github/workflows/frontend.yml +++ b/.github/workflows/frontend.yml @@ -15,10 +15,7 @@ on: - sonarqube - test - all # lancer tous les jobs - pull_request: - paths: - - "apps/frontend/**" - - ".github/workflows/frontend.yml" + # Ordre de lancement des jobs # build -> test -> sonarqube -> deploy From 1f0eb410eb067619b0e57b58c709aed6cf592cb2 Mon Sep 17 00:00:00 2001 From: ineszang44 Date: Wed, 16 Sep 2026 11:28:49 +0200 Subject: [PATCH 12/20] test(frontend): suppression des conditions if --- .github/workflows/frontend.yml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/.github/workflows/frontend.yml b/.github/workflows/frontend.yml index 1cc9af3..0f437a6 100644 --- a/.github/workflows/frontend.yml +++ b/.github/workflows/frontend.yml @@ -22,7 +22,6 @@ on: jobs: build: - if: ${{ github.event.inputs.job_choice == 'build' || github.event.inputs.job_choice == 'all' }} runs-on: ubuntu-latest steps: - uses: actions/checkout@v6 @@ -37,8 +36,7 @@ jobs: - run: npm run build working-directory: apps/frontend - test: - if: ${{ always() && (github.event.inputs.job_choice == 'test' || github.event.inputs.job_choice == 'all') }} + test: needs: build runs-on: ubuntu-latest steps: @@ -54,7 +52,6 @@ jobs: working-directory: apps/frontend sonarqube: - if: ${{ always() && (github.event.inputs.job_choice == 'sonarqube' || github.event.inputs.job_choice == 'all') }} needs: [build, test] name: SonarQube runs-on: ubuntu-latest From d1e4d8cfa04f70f3d200f3dbd1a647bd8bcb4f7b Mon Sep 17 00:00:00 2001 From: ineszang44 Date: Wed, 16 Sep 2026 11:31:10 +0200 Subject: [PATCH 13/20] =?UTF-8?q?test(frontend):=20lancement=20automatique?= =?UTF-8?q?=20du=20workflow=20apr=C3=A8s=20un=20push=20ou=20avec=20une=20p?= =?UTF-8?q?ull=20request?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/frontend.yml | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/.github/workflows/frontend.yml b/.github/workflows/frontend.yml index 0f437a6..3bc627e 100644 --- a/.github/workflows/frontend.yml +++ b/.github/workflows/frontend.yml @@ -15,8 +15,14 @@ on: - sonarqube - test - all # lancer tous les jobs - - + push: + paths: + - "apps/frontend/**" + - ".github/workflows/frontend.yml" + pull_request: + paths: + - "apps/frontend/**" + - ".github/workflows/frontend.yml" # Ordre de lancement des jobs # build -> test -> sonarqube -> deploy From 04e4913952e981573b5c4c711d851bfeafb90149 Mon Sep 17 00:00:00 2001 From: ineszang44 Date: Wed, 16 Sep 2026 12:20:15 +0200 Subject: [PATCH 14/20] fix(frontend): code smells --- .github/workflows/frontend.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/frontend.yml b/.github/workflows/frontend.yml index 3bc627e..04a5208 100644 --- a/.github/workflows/frontend.yml +++ b/.github/workflows/frontend.yml @@ -37,7 +37,7 @@ jobs: cache: npm cache-dependency-path: apps/frontend/package-lock.json - - run: npm ci + - run: npm ci --ignore-scripts working-directory: apps/frontend - run: npm run build working-directory: apps/frontend @@ -52,7 +52,7 @@ jobs: node-version: 24 cache: npm cache-dependency-path: apps/frontend/package-lock.json - - run: npm ci + - run: npm ci --ignore-scripts working-directory: apps/frontend - run: npm test -- --watch=false working-directory: apps/frontend From f43c9f76a0e8cc1d3b76e955e2705907bcbdaf47 Mon Sep 17 00:00:00 2001 From: ineszang44 Date: Wed, 16 Sep 2026 12:29:54 +0200 Subject: [PATCH 15/20] test(frontend): workflow --- .github/workflows/frontend.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/workflows/frontend.yml b/.github/workflows/frontend.yml index 04a5208..adb608d 100644 --- a/.github/workflows/frontend.yml +++ b/.github/workflows/frontend.yml @@ -37,7 +37,7 @@ jobs: cache: npm cache-dependency-path: apps/frontend/package-lock.json - - run: npm ci --ignore-scripts + - run: npm ci working-directory: apps/frontend - run: npm run build working-directory: apps/frontend @@ -52,8 +52,6 @@ jobs: node-version: 24 cache: npm cache-dependency-path: apps/frontend/package-lock.json - - run: npm ci --ignore-scripts - working-directory: apps/frontend - run: npm test -- --watch=false working-directory: apps/frontend From 730adb69b188301c76bdf5b9384b4513a5e7bdf0 Mon Sep 17 00:00:00 2001 From: ineszang44 Date: Wed, 16 Sep 2026 12:32:28 +0200 Subject: [PATCH 16/20] chore(frontend): faux positifs cwe --- .github/workflows/frontend.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/frontend.yml b/.github/workflows/frontend.yml index adb608d..98d5d53 100644 --- a/.github/workflows/frontend.yml +++ b/.github/workflows/frontend.yml @@ -52,6 +52,8 @@ jobs: node-version: 24 cache: npm cache-dependency-path: apps/frontend/package-lock.json + - run: npm ci + working-directory: apps/frontend - run: npm test -- --watch=false working-directory: apps/frontend From 970a4a50b8bf29f8cf5ea38a8073487150e8656a Mon Sep 17 00:00:00 2001 From: ineszang44 Date: Wed, 16 Sep 2026 14:22:50 +0200 Subject: [PATCH 17/20] =?UTF-8?q?fix(frontend):=20suppression=20de=20d?= =?UTF-8?q?=C3=A9pendance=20dans=20le=20service=20frontend?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docker-compose.yml | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 1a3983c..3d0ea63 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -43,17 +43,11 @@ services: - "${BACKEND_PORT:-8000}:8000" restart: unless-stopped - frontend: - build: ./apps/frontend - # si backend fonctionnel - depends_on: - backend: - condition: service_healthy - environment: - - ports: - - "${FRONTEND_PORT:-3000}:80" - restart: unless-stopped + frontend: + build: ./apps/frontend + ports: + - "${FRONTEND_PORT:-3000}:80" + restart: unless-stopped volumes: From 6ecec1afefa68acb0a982c26ef421295eb6fe4cf Mon Sep 17 00:00:00 2001 From: ineszang44 Date: Wed, 16 Sep 2026 14:40:55 +0200 Subject: [PATCH 18/20] chore(frontend): ajout du dockerignore et du dockerfile --- .dockerignore | 27 ++++++++++++++++++++++ apps/frontend/Dockerfile | 50 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 77 insertions(+) create mode 100644 .dockerignore create mode 100644 apps/frontend/Dockerfile diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..16abb4d --- /dev/null +++ b/.dockerignore @@ -0,0 +1,27 @@ +# Dépendances (réinstallées dans l'image) +node_modules/ +vendor/ +__pycache__/ +*.pyc + +# Git et IDE +.git/ +.gitignore +.vscode/ +.idea/ +*.swp + +# Fichiers de build locaux +dist/ +build/ +*.log + +# Secrets et config locale (CRITIQUE : risque d'exfiltration) +.env +.env.local +*.pem +*.key +secrets/ +.npmrc +.pypirc +kubeconfig \ No newline at end of file diff --git a/apps/frontend/Dockerfile b/apps/frontend/Dockerfile new file mode 100644 index 0000000..b6029dc --- /dev/null +++ b/apps/frontend/Dockerfile @@ -0,0 +1,50 @@ +# ================== +# Étape 1 : Build +# ================== + +# Image pour frontend +FROM dhi.io/node:24-alpine3.22 AS builder + +WORKDIR /app + +# Installation des dépendances du projet avec npm +RUN npm ci + +COPY package.json package-lock.json* ./ + + + + +# Copie du code source vers le conteneur +COPY . . + +# Build +RUN npm run build + +# ================== +# Étape 2 : Runner +# ================== + + +FROM dhi.io/nginx:1.28.0-alpine3.21-dev AS runner + +# Copie de la configuration de nginx +COPY --chown=nginx:nginx nginx.conf /etc/nginx/nginx.conf + +# Copy the static build output from the build stage to Nginx's default HTML serving directory +COPY --chown=nginx:nginx --from=builder /app/dist/*/browser /usr/share/nginx/html + +# Create necessary directories with proper permissions for nginx +RUN mkdir -p /var/log/nginx /var/cache/nginx && \ + chown -R nginx:nginx /var/log/nginx /var/cache/nginx /usr/share/nginx/html + +# Use a non-root user for security best practices +USER nginx + +# Frontend : port 3000 +# Backend : port 8000 +EXPOSE 3000 + +# Start Nginx directly with custom config +ENTRYPOINT ["nginx", "-c", "/etc/nginx/nginx.conf"] +CMD ["-g", "daemon off;"] \ No newline at end of file From 1c6b6105bd4905c15405986016d69018c80176e0 Mon Sep 17 00:00:00 2001 From: ineszang44 Date: Wed, 16 Sep 2026 14:54:12 +0200 Subject: [PATCH 19/20] chore(frontend): ajout de la configuration nginx --- apps/frontend/nginx.conf | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 apps/frontend/nginx.conf diff --git a/apps/frontend/nginx.conf b/apps/frontend/nginx.conf new file mode 100644 index 0000000..08e703d --- /dev/null +++ b/apps/frontend/nginx.conf @@ -0,0 +1,32 @@ +worker_processes auto; +error_log /var/log/nginx/error.log warn; +pid /tmp/nginx.pid; + +events { + worker_connections 1024; +} + +http { + include /etc/nginx/mime.types; + default_type application/octet-stream; + + sendfile on; + keepalive_timeout 65; + + + server { + listen 3000; + server_name _; + + root /usr/share/nginx/html; + index index.html; + + location / { + try_files $uri $uri/ /index.html; + } + + location ~ /\. { + deny all; + } + } +} From 06cb60463cd1677d8c5f31a4b9167991d4b5c4f7 Mon Sep 17 00:00:00 2001 From: ineszang44 Date: Wed, 16 Sep 2026 15:12:04 +0200 Subject: [PATCH 20/20] =?UTF-8?q?fix(frontend):=20droit=20d'acc=C3=A8s=20a?= =?UTF-8?q?u=20fichier=20de=20config=20de=20nginx,=20r=C3=A9duction=20de?= =?UTF-8?q?=20code=20smells?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/frontend/Dockerfile | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/apps/frontend/Dockerfile b/apps/frontend/Dockerfile index b6029dc..1890bc1 100644 --- a/apps/frontend/Dockerfile +++ b/apps/frontend/Dockerfile @@ -3,17 +3,14 @@ # ================== # Image pour frontend -FROM dhi.io/node:24-alpine3.22 AS builder +FROM node:24-alpine3.22 AS builder WORKDIR /app -# Installation des dépendances du projet avec npm -RUN npm ci - COPY package.json package-lock.json* ./ - - +# Installation des dépendances du projet avec npm +RUN npm ci # Copie du code source vers le conteneur COPY . . @@ -29,10 +26,10 @@ RUN npm run build FROM dhi.io/nginx:1.28.0-alpine3.21-dev AS runner # Copie de la configuration de nginx -COPY --chown=nginx:nginx nginx.conf /etc/nginx/nginx.conf +COPY --chown=root:root --chmod=755 nginx.conf /etc/nginx/nginx.conf # Copy the static build output from the build stage to Nginx's default HTML serving directory -COPY --chown=nginx:nginx --from=builder /app/dist/*/browser /usr/share/nginx/html +COPY --chown=root:root --chmod=755 --from=builder /app/dist/*/browser /usr/share/nginx/html # Create necessary directories with proper permissions for nginx RUN mkdir -p /var/log/nginx /var/cache/nginx && \