actions
This commit is contained in:
42
.gitea/workflows/deploy.yaml
Normal file
42
.gitea/workflows/deploy.yaml
Normal file
@@ -0,0 +1,42 @@
|
||||
name: Deploy to Server
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
|
||||
jobs:
|
||||
deploy:
|
||||
runs-on: ubuntu-latest
|
||||
container:
|
||||
image: alpine:latest
|
||||
steps:
|
||||
- name: Install SSH and Networking Tools
|
||||
run: apk add --no-cache openssh-client iproute2 git
|
||||
|
||||
- name: Configure SSH Key
|
||||
run: |
|
||||
mkdir -p ~/.ssh
|
||||
echo "${{ secrets.DEPLOY_SSH_KEY }}" > ~/.ssh/id_rsa
|
||||
chmod 600 ~/.ssh/id_rsa
|
||||
echo "StrictHostKeyChecking no" > ~/.ssh/config
|
||||
|
||||
- name: Execute Remote Deployment
|
||||
run: |
|
||||
HOST_IP=$(ip route | awk '/default/ { print $3 }')
|
||||
echo "==> Detected Host IP: $HOST_IP"
|
||||
|
||||
ssh adipu@$HOST_IP << 'EOF'
|
||||
set -e
|
||||
echo "==> Navigating to project directory..."
|
||||
cd ~/SousChefAI
|
||||
echo "==> Pulling latest code..."
|
||||
git pull origin main
|
||||
|
||||
echo "==> Building and starting container..."
|
||||
docker-compose up -d --build
|
||||
|
||||
echo "==> Pruning old images..."
|
||||
docker image prune -f
|
||||
echo "==> Deployment Complete!"
|
||||
EOF
|
||||
11
Dockerfile
Normal file
11
Dockerfile
Normal file
@@ -0,0 +1,11 @@
|
||||
FROM node:20-alpine AS build
|
||||
WORKDIR /app
|
||||
COPY package*.json ./
|
||||
RUN npm install
|
||||
COPY . .
|
||||
RUN npm run build
|
||||
|
||||
FROM nginx:alpine
|
||||
COPY --from=build /app/dist /usr/share/nginx/html
|
||||
EXPOSE 80
|
||||
CMD ["nginx", "-g", "daemon off;"]
|
||||
10
docker-compose.yml
Normal file
10
docker-compose.yml
Normal file
@@ -0,0 +1,10 @@
|
||||
services:
|
||||
app:
|
||||
build: .
|
||||
restart: unless-stopped
|
||||
ports:
|
||||
- "8080:80" # Maps port 8080 on the host to port 80 in the container
|
||||
deploy:
|
||||
resources:
|
||||
limits:
|
||||
memory: 128M
|
||||
Reference in New Issue
Block a user