fix(ci): drop git clone, generate docker-compose inline instead
GITHUB_TOKEN can't auth git over HTTPS on VPS, so revert to inline compose generation. nginx.conf already baked into proxy image. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.8
parent
53d16dc9cd
commit
e142bd5ad2
@@ -64,37 +64,84 @@ jobs:
|
|||||||
GHCR_USERNAME: ${{ github.actor }}
|
GHCR_USERNAME: ${{ github.actor }}
|
||||||
GHCR_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GHCR_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
ENV_FILE: ${{ secrets.ENV_FILE }}
|
ENV_FILE: ${{ secrets.ENV_FILE }}
|
||||||
GIT_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
with:
|
with:
|
||||||
host: ${{ secrets.VPS_HOST }}
|
host: ${{ secrets.VPS_HOST }}
|
||||||
username: ${{ secrets.VPS_USERNAME }}
|
username: ${{ secrets.VPS_USERNAME }}
|
||||||
key: ${{ secrets.VPS_SSH_KEY }}
|
key: ${{ secrets.VPS_SSH_KEY }}
|
||||||
envs: GHCR_USERNAME,GHCR_TOKEN,ENV_FILE,GIT_TOKEN
|
envs: GHCR_USERNAME,GHCR_TOKEN,ENV_FILE
|
||||||
script: |
|
script: |
|
||||||
set -eu
|
set -eu
|
||||||
|
|
||||||
APP_DIR=/opt/imphenbot
|
APP_DIR=/opt/imphenbot
|
||||||
REPO_URL=https://github.com/MythEclipse/GMW.git
|
mkdir -p "$APP_DIR"
|
||||||
AUTH_URL=https://x-access-token:${GIT_TOKEN}@github.com/MythEclipse/GMW.git
|
|
||||||
|
|
||||||
if [ ! -d "$APP_DIR/.git" ]; then
|
|
||||||
mkdir -p "$APP_DIR"
|
|
||||||
git clone "$AUTH_URL" "$APP_DIR"
|
|
||||||
fi
|
|
||||||
|
|
||||||
cd "$APP_DIR"
|
cd "$APP_DIR"
|
||||||
git remote set-url origin "$AUTH_URL"
|
|
||||||
git fetch origin master
|
|
||||||
git checkout master
|
|
||||||
git reset --hard origin/master
|
|
||||||
|
|
||||||
printf '%s\n' "$ENV_FILE" > .env
|
printf '%s\n' "$ENV_FILE" > .env
|
||||||
|
|
||||||
mkdir -p recordings
|
mkdir -p recordings
|
||||||
|
|
||||||
|
cat > docker-compose.yml <<'COMPOSE_EOF'
|
||||||
|
version: '3.8'
|
||||||
|
|
||||||
|
services:
|
||||||
|
proxy:
|
||||||
|
image: ghcr.io/${OWNER:-mytheclipse}/bete-proxy:latest
|
||||||
|
container_name: imphenbot-proxy
|
||||||
|
restart: unless-stopped
|
||||||
|
labels:
|
||||||
|
- "traefik.enable=true"
|
||||||
|
- "traefik.http.routers.imphenbot.rule=Host(`imphnen.asepharyana.my.id`)"
|
||||||
|
- "traefik.http.routers.imphenbot.entrypoints=websecure"
|
||||||
|
- "traefik.http.routers.imphenbot.tls=true"
|
||||||
|
- "traefik.http.services.imphenbot.loadbalancer.server.port=80"
|
||||||
|
depends_on:
|
||||||
|
- backend
|
||||||
|
- frontend
|
||||||
|
networks:
|
||||||
|
- app-shared-net
|
||||||
|
|
||||||
|
backend:
|
||||||
|
image: ghcr.io/${OWNER:-mytheclipse}/bete-backend:latest
|
||||||
|
container_name: imphenbot-backend
|
||||||
|
restart: unless-stopped
|
||||||
|
env_file:
|
||||||
|
- .env
|
||||||
|
environment:
|
||||||
|
NODE_ENV: production
|
||||||
|
WEBSERVER_PORT: 3000
|
||||||
|
depends_on:
|
||||||
|
- discord-gateway
|
||||||
|
networks:
|
||||||
|
- app-shared-net
|
||||||
|
|
||||||
|
discord-gateway:
|
||||||
|
image: ghcr.io/${OWNER:-mytheclipse}/bete-discord-gateway:latest
|
||||||
|
container_name: imphenbot-discord-gateway
|
||||||
|
restart: unless-stopped
|
||||||
|
env_file:
|
||||||
|
- .env
|
||||||
|
environment:
|
||||||
|
NODE_ENV: production
|
||||||
|
volumes:
|
||||||
|
- ./recordings:/app/recordings
|
||||||
|
networks:
|
||||||
|
- app-shared-net
|
||||||
|
|
||||||
|
frontend:
|
||||||
|
image: ghcr.io/${OWNER:-mytheclipse}/bete-frontend:latest
|
||||||
|
container_name: imphenbot-frontend
|
||||||
|
restart: unless-stopped
|
||||||
|
networks:
|
||||||
|
- app-shared-net
|
||||||
|
|
||||||
|
networks:
|
||||||
|
app-shared-net:
|
||||||
|
name: app-shared-net
|
||||||
|
external: true
|
||||||
|
COMPOSE_EOF
|
||||||
|
|
||||||
echo "$GHCR_TOKEN" | docker login ghcr.io -u "$GHCR_USERNAME" --password-stdin
|
echo "$GHCR_TOKEN" | docker login ghcr.io -u "$GHCR_USERNAME" --password-stdin
|
||||||
|
|
||||||
docker compose -f infra/docker/docker-compose.yml pull
|
docker compose pull
|
||||||
docker compose -f infra/docker/docker-compose.yml down --remove-orphans || true
|
docker compose down --remove-orphans || true
|
||||||
docker compose -f infra/docker/docker-compose.yml up -d --remove-orphans
|
docker compose up -d --remove-orphans
|
||||||
docker image prune -f
|
docker image prune -f
|
||||||
|
|||||||
Reference in New Issue
Block a user