chore: remove duplicate build.yaml workflow, keep only docker.yml
This commit is contained in:
@@ -1,94 +0,0 @@
|
|||||||
name: Docker Build
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
branches:
|
|
||||||
- main
|
|
||||||
- master
|
|
||||||
tags:
|
|
||||||
- 'v*'
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
build-and-push:
|
|
||||||
name: Build and Push Docker Image
|
|
||||||
runs-on: act-runner-4c6g
|
|
||||||
env:
|
|
||||||
RUNNER_TOOL_CACHE: /toolcache
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: Install Docker CLI
|
|
||||||
run: |
|
|
||||||
if ! command -v docker &> /dev/null; then
|
|
||||||
if command -v apk &> /dev/null; then
|
|
||||||
apk add --no-cache docker-cli
|
|
||||||
elif command -v apt-get &> /dev/null; then
|
|
||||||
apt-get update && apt-get install -y docker.io
|
|
||||||
else
|
|
||||||
curl -fsSL https://download.docker.com/linux/static/stable/x86_64/docker-24.0.7.tgz | tar xz -C /tmp
|
|
||||||
mv /tmp/docker/docker /usr/local/bin/
|
|
||||||
chmod +x /usr/local/bin/docker
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
docker --version
|
|
||||||
|
|
||||||
- name: Install Node.js
|
|
||||||
run: |
|
|
||||||
export PATH="/toolcache/bin:$PATH"
|
|
||||||
if ! command -v node &> /dev/null; then
|
|
||||||
if command -v apk &> /dev/null; then
|
|
||||||
apk add --no-cache nodejs npm
|
|
||||||
else
|
|
||||||
curl -fsSL https://nodejs.org/dist/v22.0.0/node-v22.0.0-linux-x64.tar.xz | tar -xJ -C /tmp
|
|
||||||
cp -r /tmp/node-v22.0.0-linux-x64/{bin,lib,share} /toolcache/
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
node --version
|
|
||||||
|
|
||||||
- name: Checkout repository
|
|
||||||
uses: actions/checkout@v4
|
|
||||||
|
|
||||||
- name: Login to Gitea Container Registry
|
|
||||||
run: |
|
|
||||||
echo "${{ secrets.PACKAGES_TOKEN }}" | docker login git.viaeon.com -u "${{ github.actor }}" --password-stdin 2>&1
|
|
||||||
|
|
||||||
- name: Build Docker image
|
|
||||||
run: |
|
|
||||||
echo "Building image..."
|
|
||||||
docker build \
|
|
||||||
--label "org.opencontainers.image.source=https://git.viaeon.com/admin/sale" \
|
|
||||||
--label "org.opencontainers.image.revision=${{ github.sha }}" \
|
|
||||||
-f backend/Dockerfile \
|
|
||||||
-t git.viaeon.com/admin/sale:${{ github.ref_name }} \
|
|
||||||
-t git.viaeon.com/admin/sale:latest . 2>&1
|
|
||||||
|
|
||||||
- name: Push Docker image
|
|
||||||
run: |
|
|
||||||
echo "Pushing ${{ github.ref_name }}..."
|
|
||||||
docker push git.viaeon.com/admin/sale:${{ github.ref_name }} 2>&1
|
|
||||||
echo "Pushing latest..."
|
|
||||||
docker push git.viaeon.com/admin/sale:latest 2>&1
|
|
||||||
|
|
||||||
deploy:
|
|
||||||
name: Deploy to Server
|
|
||||||
runs-on: act-runner-4c6g
|
|
||||||
needs: build-and-push
|
|
||||||
if: github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master'
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: Install SSH client
|
|
||||||
run: |
|
|
||||||
if command -v apk &> /dev/null; then
|
|
||||||
apk add --no-cache openssh-client sshpass
|
|
||||||
elif command -v apt-get &> /dev/null; then
|
|
||||||
apt-get update && apt-get install -y openssh-client sshpass
|
|
||||||
fi
|
|
||||||
|
|
||||||
- name: Deploy to server
|
|
||||||
run: |
|
|
||||||
sshpass -p '${{ secrets.DEPLOY_PASSWORD }}' ssh -o StrictHostKeyChecking=no ${{ secrets.DEPLOY_USER }}@${{ secrets.DEPLOY_HOST }} << 'EOF'
|
|
||||||
cd ${{ secrets.DEPLOY_PATH }}
|
|
||||||
docker compose pull
|
|
||||||
docker compose down
|
|
||||||
docker compose up -d
|
|
||||||
docker image prune -f
|
|
||||||
EOF
|
|
||||||
Reference in New Issue
Block a user