added build confs
All checks were successful
Build & Deploy Vite App (Docker Compose) / build-and-deploy (push) Successful in 54s

This commit is contained in:
Atakan
2025-11-28 16:31:20 +03:00
parent b9ef84fd7e
commit 3adb87d40d
4 changed files with 46 additions and 28 deletions

View File

@@ -1,42 +1,22 @@
name: Build & Deploy Vite App (Docker)
name: Build & Deploy Vite App (Docker Compose)
on:
push:
branches:
- main # kendi ana branch'ini yaz
- main # hangi branch'i takip edeceksen onu yaz
jobs:
build-and-deploy:
runs-on: ubuntu-latest # runner'ın default label'ı, act_runner buna sahip olmalı
runs-on: ubuntu-latest
steps:
- name: Kodu checkout et
uses: actions/checkout@v3
# 1) Build'i Docker container içinde çalıştır
- name: Docker ile Vite build al
- name: Docker Compose ile deploy
run: |
docker run --rm \
-v $PWD:/app \
-w /app \
node:24 \
/bin/bash -lc "npm install && npm run build"
# Eski container'ları kapat
docker compose down || true
# 2) Docker image oluştur
- name: Docker image build et
run: |
docker build -t website-app:latest .
# 3) Eski container'ı durdur / sil
- name: Eski container'ı durdur ve sil
run: |
docker stop website-app || true
docker rm website-app || true
# 4) Yeni image ile container'ı ayağa kaldır
- name: Yeni container'ı başlat
run: |
docker run -d \
--name website-app \
-p 3005:80 \
website-app:latest
# Image'i yeniden build et ve container'ı ayağa kaldır
docker compose up -d --build