updated ci/cd pipeline

This commit is contained in:
shrt 2025-03-17 16:02:54 +01:00
parent 6f68f2069d
commit 0d853e695f
4 changed files with 25 additions and 7 deletions

View File

@ -9,6 +9,11 @@ jobs:
deploy:
runs-on: linux
steps:
- name: Test Step
- name: Setup SSH Key
run: |
echo "Hello World from Gitea Actions!"
mkdir -p ~/.ssh
echo "${{ secrets.SSH_PRIVATE_KEY }}" > ~/.ssh/id_ed25519
chmod 600 ~/.ssh/id_ed25519
ssh-keyscan -H "${{ secrets.SSH_HOST }}" >> ~/.ssh/known_hosts
- name: Deploy via SSH
run: ssh ${{ secrets.SSH_USER }}@${{ secrets.SSH_HOST }} "bash ~/deploy.sh ${{ secrets.PROJECT_DEPLOYMENT_PATH }}"

View File

@ -1,15 +1,11 @@
# Use official Node.js image
FROM node:18-alpine
# Install pnpm globally
RUN npm install -g pnpm
WORKDIR /app
# Copy package manager files first for caching
COPY package.json pnpm-lock.yaml ./
# Install dependencies using pnpm
RUN pnpm install --frozen-lockfile
COPY . .

15
deploy.sh Normal file
View File

@ -0,0 +1,15 @@
#!/bin/bash
set -e
if [ -z "$1" ]; then
echo "Usage: $0 <project_path>"
exit 1
fi
PROJECT_PATH=$1
echo "Deploying project..."
cd "$PROJECT_PATH" || { echo "Directory not found: $PROJECT_PATH"; exit 1; }
git pull origin main
docker-compose up -d --build
echo "Deployment finished!"

View File

@ -13,10 +13,12 @@ services:
- "traefik.enable=true"
- "traefik.http.routers.pablo-shortman-me.rule=Host(`pablo.shortman.me`)"
- "traefik.http.routers.pablo-shortman-me.entrypoints=websecure"
- "traefik.http.services.pablo-shortman-me.loadbalancer.server.port=3000"
- "traefik.http.routers.pablo-shortman-me.tls.certresolver=myresolver"
expose:
- "3000"
networks:
- webproxy
networks:
webproxy:
external: true