Skip to content

Commit

Permalink
ci: Deploy to CA VPS #84
Browse files Browse the repository at this point in the history
  • Loading branch information
JulesGresset committed Dec 18, 2024
1 parent 43f9da0 commit 6dd4523
Show file tree
Hide file tree
Showing 3 changed files with 57 additions and 0 deletions.
38 changes: 38 additions & 0 deletions .github/workflows/deploy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,41 @@ 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 }}
EXCLUDE: "/node_modules/"
SCRIPT_AFTER: |
echo "DB_NAME=\"${{ secrets.BACKEND_DB_NAME }}\"" >> ${{ secrets.VPS_CA_TARGET }}.env
echo "DB_URL=\"${{ secrets.BACKEND_DB_URL }}\"" >> ${{ secrets.VPS_CA_TARGET }}.env
echo "SALT_HASH=\"${{ secrets.BACKEND_SALT }}\"" >> ${{ secrets.VPS_CA_TARGET }}.env
sleep 2
./restartBackend.sh
SCRIPT_AFTER_REQUIRED: true
8 changes: 8 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
FROM node:18
WORKDIR /app
COPY package*.json ./
RUN npm install
COPY . .
RUN npm run build
EXPOSE 3000
CMD ["npm", "run", "start:prod"]
11 changes: 11 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
version: "3.8"
services:
backend:
container_name: backend
build: .
ports:
- "3000:3000"
volumes:
- .:/app
- /app/node_modules
command: npm run start:prod

0 comments on commit 6dd4523

Please sign in to comment.