Configure board deployment and backend proxy
This commit is contained in:
@@ -0,0 +1,68 @@
|
||||
name: Build, Push and Deploy
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [main, master, hotfix/*]
|
||||
|
||||
env:
|
||||
HARBOR: 192.168.31.213:10081
|
||||
HARBOR_REGISTRY: 192.168.31.213:10081
|
||||
HARBOR_PROJECT: wordcloud
|
||||
APP_PORT: 47880
|
||||
WORDCLOUD_API_UPSTREAM: http://192.168.31.213:8000
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout code
|
||||
run: |
|
||||
set -euo pipefail
|
||||
GITEA_URL="${GITHUB_SERVER_URL:-http://192.168.31.213:10880}"
|
||||
git init -q .
|
||||
git remote add origin "$GITEA_URL/$GITHUB_REPOSITORY.git"
|
||||
git fetch -q --depth 1 origin "$GITHUB_SHA"
|
||||
git checkout -q "$GITHUB_SHA"
|
||||
|
||||
- name: Login Harbor
|
||||
run: |
|
||||
echo "${{ secrets.HARBOR_PASS }}" | docker login "$HARBOR" \
|
||||
-u "${{ secrets.HARBOR_USER }}" --password-stdin
|
||||
|
||||
- name: Build Docker images
|
||||
run: |
|
||||
if docker compose version >/dev/null 2>&1; then
|
||||
COMPOSE="docker compose"
|
||||
else
|
||||
COMPOSE="docker-compose"
|
||||
fi
|
||||
$COMPOSE build
|
||||
|
||||
- name: Tag and push images
|
||||
run: |
|
||||
set -euo pipefail
|
||||
SHA="${{ github.sha }}"
|
||||
for name in wordcloud-board-app wordcloud-board-realtime; do
|
||||
image="$HARBOR/$HARBOR_PROJECT/$name"
|
||||
docker tag "$image:latest" "$image:$SHA"
|
||||
docker push "$image:latest"
|
||||
docker push "$image:$SHA"
|
||||
done
|
||||
|
||||
deploy:
|
||||
needs: build
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout deploy config
|
||||
run: |
|
||||
set -euo pipefail
|
||||
GITEA_URL="${GITHUB_SERVER_URL:-http://192.168.31.213:10880}"
|
||||
git init -q .
|
||||
git remote add origin "$GITEA_URL/$GITHUB_REPOSITORY.git"
|
||||
git fetch -q --depth 1 origin "$GITHUB_SHA"
|
||||
git checkout -q "$GITHUB_SHA"
|
||||
|
||||
- name: Deploy WordCloud Board
|
||||
run: |
|
||||
chmod +x ./deploy.sh
|
||||
./deploy.sh wordcloud-board production "${{ github.sha }}"
|
||||
Reference in New Issue
Block a user