Skip to content

Commit

Permalink
add deploy ci
Browse files Browse the repository at this point in the history
  • Loading branch information
KasperiP committed Aug 1, 2023
1 parent 50af2e2 commit 9d6448f
Show file tree
Hide file tree
Showing 3 changed files with 53 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
node_modules
npm-debug.log
Dockerfile
.dockerignore
32 changes: 32 additions & 0 deletions .github/workflows/deploy.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: CI

on:
push:
branches: ['master']

jobs:
deploy:
name: Deploy to VPS
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v3

- name: executing remote ssh commands using password
uses: appleboy/ssh-action@v0.1.10
with:
host: ${{ secrets.SSH_IP }}
username: ${{ secrets.SSH_USERNAME }}
password: ${{ secrets.SSH_PASSWORD }}
port: ${{ secrets.SSH_PORT }}
script: |
cd unisafka-discord
rm -rf unisafka-discord
git clone https://github.com/KasperiP/unisafka-discord.git
cp .env unisafka-discord/.env
cd unisafka-discord
docker stop unisafka-discord
docker rm unisafka-discord
docker build -t unisafka-discord .
docker run -d --restart=always --name unisafka-discord unisafka-discord
17 changes: 17 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Use the official Node.js LTS (Long Term Support) image as the base image
FROM node:20-alpine

# Set the working directory inside the container
WORKDIR /usr/src/app

# Copy the package.json and package-lock.json (if you have it) to the working directory
COPY package*.json ./

# Install Node.js dependencies
RUN npm install

# Copy the rest of your application's source code to the container
COPY . .

# Define the command to run your Node.js application
CMD ["node", "main.js"]

0 comments on commit 9d6448f

Please sign in to comment.