From 0ca9c3af4f244e64a75a00b3658280b1feba1761 Mon Sep 17 00:00:00 2001 From: Jules Date: Wed, 18 Dec 2024 17:33:32 -0500 Subject: [PATCH] ef --- .github/workflows/deploy.yaml | 31 +++++++++++++++++++++++++++++++ Dockerfile | 8 ++++++++ docker-compose.yml | 11 +++++++++++ 3 files changed, 50 insertions(+) create mode 100644 Dockerfile create mode 100644 docker-compose.yml diff --git a/.github/workflows/deploy.yaml b/.github/workflows/deploy.yaml index de6e4dd..7166fc1 100644 --- a/.github/workflows/deploy.yaml +++ b/.github/workflows/deploy.yaml @@ -38,3 +38,34 @@ jobs: git add . git commit -m "Update from Back-End (Automation)" git push origin main + + deployVPSCA: + + runs-on: ubuntu-latest + + name: Deploy to VPS CA + + steps: + - name: Checkout code + uses: actions/checkout@v2 + + - name: Use Node.js + uses: actions/setup-node@v3 + with: + node-version: '18.X' + + - name: Install dependencies + run: npm install + + - name: Build + run: npm run build + + - name: Deploy to VPS CA + uses: easingthemes/ssh-deploy@main + with: + SSH_PRIVATE_KEY: ${{ secrets.VPS_CA_SSH }} + ARGS: "-rlgoDzvc --delete" + REMOTE_HOST: ${{ secrets.VPS_CA_HOST }} + REMOTE_USER: ${{ secrets.VPS_CA_USERNAME }} + TARGET: ${{ secrets.VPS_CA_TARGET }} + SCRIPT_AFTER: '~/restartBackend.sh' diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..81c160c --- /dev/null +++ b/Dockerfile @@ -0,0 +1,8 @@ +FROM node:18 +WORKDIR /app +COPY package*.json ./ +RUN npm install +COPY . . +RUN npm run build +EXPOSE 4000 +CMD ["npm", "run", "start:prod"] \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..31db8d9 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,11 @@ +version: "3.8" +services: + backend: + container_name: backend + build: . + ports: + - "4000:4000" + volumes: + - .:/app + - /app/node_modules + command: npm run start:prod