This commit is contained in:
25
.github/workflows/deploy.yml
vendored
25
.github/workflows/deploy.yml
vendored
@@ -15,31 +15,32 @@ jobs:
|
|||||||
username: ${{ secrets.REMOTE_USER }}
|
username: ${{ secrets.REMOTE_USER }}
|
||||||
key: ${{ secrets.SSH_PRIVATE_KEY }}
|
key: ${{ secrets.SSH_PRIVATE_KEY }}
|
||||||
passphrase: ${{ secrets.SSH_PASSPHRASE }}
|
passphrase: ${{ secrets.SSH_PASSPHRASE }}
|
||||||
|
script_shell: pwsh
|
||||||
script: |
|
script: |
|
||||||
# Navigate to project directory or clone if it doesn't exist
|
# Navigate to project directory or clone if it doesn't exist
|
||||||
if (Test-Path "C:\projects\digital-resume-FE") {
|
if (Test-Path "C:\projects\digital-resume-FE") {
|
||||||
cd C:\projects\digital-resume-FE
|
Set-Location C:\projects\digital-resume-FE
|
||||||
git pull origin main
|
git pull origin main
|
||||||
} else {
|
} else {
|
||||||
mkdir -p C:\projects
|
New-Item -ItemType Directory -Path C:\projects -Force
|
||||||
cd C:\projects
|
Set-Location C:\projects
|
||||||
git clone https://gitea.sashabayda.ca/Bayda77/digital-resume-FE.git
|
git clone https://gitea.sashabayda.ca/Bayda77/digital-resume-FE.git
|
||||||
cd digital-resume-FE
|
Set-Location digital-resume-FE
|
||||||
}
|
}
|
||||||
|
|
||||||
# Stop and remove existing container
|
# Stop and remove existing container if it exists
|
||||||
docker stop resume-frontend 2>$null
|
$container = docker ps -a -q -f name=resume-frontend
|
||||||
docker rm resume-frontend 2>$null
|
if ($container) {
|
||||||
|
docker stop resume-frontend
|
||||||
|
Start-Sleep -Seconds 2
|
||||||
|
docker rm resume-frontend
|
||||||
|
}
|
||||||
|
|
||||||
# Build the Docker image
|
# Build the Docker image
|
||||||
docker build -t resume-frontend:latest .
|
docker build -t resume-frontend:latest .
|
||||||
|
|
||||||
# Run new container
|
# Run new container
|
||||||
docker run -d `
|
docker run -d --name resume-frontend --restart unless-stopped -p 3000:80 resume-frontend:latest
|
||||||
--name resume-frontend `
|
|
||||||
--restart unless-stopped `
|
|
||||||
-p 3000:80 `
|
|
||||||
resume-frontend:latest
|
|
||||||
|
|
||||||
# Cleanup unused images
|
# Cleanup unused images
|
||||||
docker image prune -f
|
docker image prune -f
|
||||||
|
|||||||
Reference in New Issue
Block a user