Update Docker configuration and add Gitea CI/CD workflows
- Change Docker image in docker-compose.prod.yml to use 'portfolio-app:latest'. - Add new scripts for Gitea deployment and setup of Gitea runner. - Introduce CI/CD workflows for automated testing, security scanning, and deployment in Gitea. - Enhance package.json with new deployment scripts for Gitea integration.
This commit is contained in:
54
.gitea/workflows/quick-deploy.yml
Normal file
54
.gitea/workflows/quick-deploy.yml
Normal file
@@ -0,0 +1,54 @@
|
||||
name: Quick Deploy
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ main ]
|
||||
workflow_dispatch:
|
||||
|
||||
env:
|
||||
NODE_VERSION: '20'
|
||||
DOCKER_IMAGE: portfolio-app
|
||||
CONTAINER_NAME: portfolio-app
|
||||
|
||||
jobs:
|
||||
quick-deploy:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Setup Node.js
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: ${{ env.NODE_VERSION }}
|
||||
cache: 'npm'
|
||||
|
||||
- name: Install dependencies
|
||||
run: npm ci
|
||||
|
||||
- name: Build application
|
||||
run: npm run build
|
||||
|
||||
- name: Build Docker image
|
||||
run: |
|
||||
docker build -t ${{ env.DOCKER_IMAGE }}:latest .
|
||||
|
||||
- name: Stop existing container
|
||||
run: |
|
||||
docker stop ${{ env.CONTAINER_NAME }} || true
|
||||
docker rm ${{ env.CONTAINER_NAME }} || true
|
||||
|
||||
- name: Start new container
|
||||
run: |
|
||||
docker run -d \
|
||||
--name ${{ env.CONTAINER_NAME }} \
|
||||
--restart unless-stopped \
|
||||
-p 3000:3000 \
|
||||
-e NODE_ENV=production \
|
||||
${{ env.DOCKER_IMAGE }}:latest
|
||||
|
||||
- name: Health check
|
||||
run: |
|
||||
sleep 10
|
||||
curl -f http://localhost:3000/api/health
|
||||
echo "✅ Quick deployment successful!"
|
||||
Reference in New Issue
Block a user