Route preview API through Docker network
Verify mini program and deploy preview / verify-deploy (push) Successful in 24s
Verify mini program and deploy preview / verify-deploy (push) Successful in 24s
This commit is contained in:
@@ -16,7 +16,7 @@ jobs:
|
||||
SOURCE_REPOSITORY: ${{ gitea.repository }}
|
||||
SOURCE_REVISION: ${{ gitea.sha }}
|
||||
DEPLOY_PORT: ${{ vars.DEPLOY_PORT || '3000' }}
|
||||
API_BASE_URL: ${{ vars.API_BASE_URL || 'http://47.83.180.156:18082' }}
|
||||
API_BASE_URL: ${{ vars.API_BASE_URL }}
|
||||
steps:
|
||||
- name: Fetch exact revision
|
||||
env: { SOURCE_TOKEN: "${{ secrets.GITEA_TOKEN || gitea.token }}" }
|
||||
@@ -41,8 +41,9 @@ jobs:
|
||||
if: gitea.event_name == 'push' && gitea.ref == 'refs/heads/main'
|
||||
run: |
|
||||
set -eu
|
||||
docker network inspect pk-lab-public >/dev/null 2>&1 || docker network create pk-lab-public
|
||||
docker rm -f pk-lab-xhs-preview 2>/dev/null || true
|
||||
docker run -d --name pk-lab-xhs-preview --restart unless-stopped --read-only --tmpfs /tmp --tmpfs /var/cache/nginx --tmpfs /var/run -e API_BASE_URL="$API_BASE_URL" -p "$DEPLOY_PORT:8080" "pk-lab-xhs:$SOURCE_REVISION"
|
||||
docker run -d --name pk-lab-xhs-preview --restart unless-stopped --network pk-lab-public --read-only --tmpfs /tmp --tmpfs /var/cache/nginx --tmpfs /var/run -e API_BASE_URL="$API_BASE_URL" -p "$DEPLOY_PORT:8080" "pk-lab-xhs:$SOURCE_REVISION"
|
||||
for i in 1 2 3 4 5 6 7 8 9 10; do
|
||||
status="$(docker inspect --format '{{.State.Health.Status}}' pk-lab-xhs-preview)"
|
||||
[ "$status" = healthy ] && exit 0
|
||||
|
||||
Reference in New Issue
Block a user