From 39de20c4864fea296aa98d17951fb3028d4d3226 Mon Sep 17 00:00:00 2001 From: Arthur Date: Sat, 13 Sep 2025 01:06:06 +0200 Subject: [PATCH] =?UTF-8?q?Ajout=20des=20fichiers=20de=20configuration=20p?= =?UTF-8?q?our=20le=20d=C3=A9ploiement=20et=20la=20composition=20Docker?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/deploy.yml | 21 +++++++++++++++++++++ docker-compose.yml | 14 ++++++++++++++ 2 files changed, 35 insertions(+) create mode 100644 .github/workflows/deploy.yml create mode 100644 docker-compose.yml diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml new file mode 100644 index 0000000..c42da7a --- /dev/null +++ b/.github/workflows/deploy.yml @@ -0,0 +1,21 @@ +name: Deploy to VM Prod + +on: + push: + branches: + - main # déclenche le déploiement quand tu push sur main + +jobs: + deploy: + runs-on: self-hosted # ton runner VM code-server + steps: + - name: Checkout repository + uses: actions/checkout@v3 + + - name: Deploy to production + run: | + ssh ${{ secrets.SSH_USER }}@${{ secrets.SSH_HOST }} " + cd ${{ secrets.DEPLOY_PATH }} || exit 1 + git pull origin main + docker compose up -d --build + " diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..a7bd3a2 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,14 @@ +version: '3.8' + +services: + app: + image: node:18 + working_dir: /usr/src/app + volumes: + - ./:/usr/src/app + ports: + - "3000:3000" + environment: + - NODE_ENV=production + - PORT=3000 + command: sh -c "npm install && npm start" \ No newline at end of file