diff --git a/.forgejo/workflows/docker-build.yml b/.forgejo/workflows/docker-build.yml index 1f6eeb4..1b18d53 100644 --- a/.forgejo/workflows/docker-build.yml +++ b/.forgejo/workflows/docker-build.yml @@ -15,6 +15,8 @@ on: env: REGISTRY: git.khoavo.myds.me IMAGE: git.khoavo.myds.me/vndangkhoa/kv-tube + REG_USER: vndangkhoa + REG_PASS: Thieugia19 jobs: build: @@ -22,7 +24,7 @@ jobs: steps: - name: Checkout run: | - git clone https://vndangkhoa:${{ secrets.FORGEJO_PASSWORD }}@git.khoavo.myds.me/vndangkhoa/kv-tube.git /tmp/kv-tube + git clone https://${REG_USER}:${REG_PASS}@${REGISTRY}/vndangkhoa/kv-tube.git /tmp/kv-tube cd /tmp/kv-tube git checkout ${GITHUB_SHA:-main} echo "Checked out commit: $(git rev-parse --short HEAD)" @@ -31,19 +33,19 @@ jobs: run: docker info - name: Log into registry - run: echo "${{ secrets.FORGEJO_PASSWORD }}" | docker login ${{ env.REGISTRY }} -u ${{ secrets.FORGEJO_USERNAME }} --password-stdin + run: echo "${REG_PASS}" | docker login ${REGISTRY} -u ${REG_USER} --password-stdin - name: Build and push run: | cd /tmp/kv-tube SHA_SHORT=$(git rev-parse --short HEAD) - TAGS="${{ env.IMAGE }}:${SHA_SHORT}" + TAGS="${IMAGE}:${SHA_SHORT}" if [ "${GITHUB_REF}" = "refs/heads/main" ] || [ "${GITHUB_REF}" = "refs/heads/master" ]; then - TAGS="${TAGS},${{ env.IMAGE }}:main" + TAGS="${TAGS},${IMAGE}:main" fi if echo "${GITHUB_REF}" | grep -q "refs/tags/v"; then VERSION=${GITHUB_REF#refs/tags/v} - TAGS="${TAGS},${{ env.IMAGE }}:${VERSION},${{ env.IMAGE }}:latest" + TAGS="${TAGS},${IMAGE}:${VERSION},${IMAGE}:latest" fi echo "Building tags: ${TAGS}" diff --git a/.forgejo/workflows/test-clone.yml b/.forgejo/workflows/test-clone.yml deleted file mode 100644 index f1d25ab..0000000 --- a/.forgejo/workflows/test-clone.yml +++ /dev/null @@ -1,27 +0,0 @@ -name: Test Git Clone - -on: - push: - branches: [main, master] - workflow_dispatch: - -jobs: - test: - runs-on: docker - steps: - - name: Test clone - run: | - echo "Testing DNS..." - nslookup git.khoavo.myds.me || echo "DNS failed" - echo "---" - echo "Testing curl..." - curl -s -o /dev/null -w "%{http_code}" https://git.khoavo.myds.me/vndangkhoa/kv-tube || echo "curl failed" - echo "" - echo "---" - echo "Testing git clone..." - git clone https://git.khoavo.myds.me/vndangkhoa/kv-tube.git /tmp/test-clone 2>&1 || echo "Clone failed" - echo "---" - if [ -d /tmp/test-clone ]; then - echo "Clone succeeded!" - cd /tmp/test-clone && git log --oneline -3 - fi diff --git a/.forgejo/workflows/test-host.yml b/.forgejo/workflows/test-host.yml deleted file mode 100644 index 0c0e5be..0000000 --- a/.forgejo/workflows/test-host.yml +++ /dev/null @@ -1,25 +0,0 @@ -name: Test Host - -on: - push: - branches: [main, master] - workflow_dispatch: - -jobs: - test: - runs-on: docker - steps: - - name: Check tools - run: | - echo "=== PATH ===" - echo $PATH - echo "=== Git ===" - which git && git --version || echo "git NOT found" - echo "=== Docker ===" - which docker && docker version --format '{{.Server.Version}}' || echo "docker NOT found" - echo "=== Node ===" - which node && node --version || echo "node NOT found" - echo "=== OS ===" - uname -a - echo "=== Whoami ===" - whoami diff --git a/Dockerfile b/Dockerfile index a62b96a..f468fb1 100644 --- a/Dockerfile +++ b/Dockerfile @@ -18,11 +18,12 @@ COPY frontend/package.json frontend/package-lock.json ./ RUN npm ci FROM node:20-alpine AS frontend-builder +ARG NEXT_PUBLIC_API_URL=http://127.0.0.1:8080 WORKDIR /app COPY --from=frontend-deps /app/node_modules ./node_modules COPY frontend/ ./ ENV NEXT_TELEMETRY_DISABLED 1 -ENV NEXT_PUBLIC_API_URL=http://localhost:8080 +ENV NEXT_PUBLIC_API_URL=${NEXT_PUBLIC_API_URL} RUN echo "NEXT_PUBLIC_API_URL=$NEXT_PUBLIC_API_URL" && npm run build # ---- Final Unified Image ---- diff --git a/docker-compose.forgejo.yml b/docker-compose.forgejo.yml new file mode 100644 index 0000000..6eb5245 --- /dev/null +++ b/docker-compose.forgejo.yml @@ -0,0 +1,41 @@ +services: + server: + image: codeberg.org/forgejo/forgejo:9 + container_name: forgejo + environment: + - USER_UID=1026 + - USER_GID=100 + - GITEA__database__DB_TYPE=sqlite3 + - TZ=Asia/Ho_Chi_Minh + restart: always + networks: + - forgejo_custom_net + volumes: + - ./data:/data + ports: + - "3050:3000" + - "2222:22" + + runner: + image: code.forgejo.org/forgejo/runner:6.0.1 + container_name: forgejo_runner + restart: always + user: "0:0" + depends_on: + - server + networks: + - forgejo_custom_net + volumes: + - /var/run/docker.sock:/var/run/docker.sock + - ./runner-data:/data + entrypoint: > + sh -c "if [ ! -f /data/.runner ]; then forgejo-runner register --no-interactive --instance http://server:3000 --token xP3IdP05YPJJZ504z7UzK90njFFzQnX4d77cJiCN --name synology-runner --labels ubuntu-latest:docker://node:20-bookworm,ubuntu-22.04:docker://node:20-bookworm,docker:host; fi; forgejo-runner daemon" + environment: + - TZ=Asia/Ho_Chi_Minh + +networks: + forgejo_custom_net: + driver: bridge + ipam: + config: + - subnet: 172.35.0.0/24 diff --git a/docker-compose.yml b/docker-compose.yml index 88acdd1..b3ac6d5 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -7,9 +7,10 @@ services: kv-tube: build: context: . + dockerfile: Dockerfile args: - NEXT_PUBLIC_API_URL=http://ut.khoavo.myds.me:8981/api - image: git.khoavo.myds.me/vndangkhoa/kv-tube:v7 + image: git.khoavo.myds.me/vndangkhoa/kv-tube:v9 container_name: kv-tube platform: linux/amd64 restart: unless-stopped @@ -22,7 +23,6 @@ services: - KVTUBE_DATA_DIR=/app/data - GIN_MODE=release - NODE_ENV=production - - NEXT_PUBLIC_API_URL=http://ut.khoavo.myds.me:8981/api - CORS_ALLOWED_ORIGINS=https://ut.khoavo.myds.me,http://ut.khoavo.myds.me:5011,http://localhost:3000,http://127.0.0.1:3000 labels: - "com.centurylinklabs.watchtower.enable=true" diff --git a/frontend/frontend.log b/frontend/frontend.log index ad87c9a..4d0750a 100644 --- a/frontend/frontend.log +++ b/frontend/frontend.log @@ -1919,3 +1919,20 @@ All Invidious instances failed: [ GET / 200 in 320ms (compile: 88ms, render: 232ms) GET /watch?v=XBPoRUlgD-0 200 in 79ms (compile: 63ms, render: 16ms) GET / 200 in 438ms (compile: 117ms, render: 320ms) + GET /watch?v=kgkNd4l3OpU 200 in 36ms (compile: 12ms, render: 23ms) + GET / 200 in 70ms (compile: 8ms, render: 62ms) + GET / 200 in 55ms (compile: 19ms, render: 36ms) + GET / 200 in 85ms (compile: 14ms, render: 71ms) +✓ Compiled in 213ms +⚠ Found a change in next.config.mjs. Restarting the server to apply the changes... +▲ Next.js 16.1.6 (Turbopack) +- Local: http://localhost:3000 +- Network: http://192.168.1.73:3000 +- Environments: .env.local + +✓ Starting... +✓ Ready in 603ms + GET / 200 in 762ms (compile: 562ms, render: 200ms) +(node:32033) [DEP0060] DeprecationWarning: The `util._extend` API is deprecated. Please use Object.assign() instead. +(Use `node --trace-deprecation ...` to show where the warning was created) +[?25h diff --git a/supervisord.conf b/supervisord.conf index db83b44..4d888a8 100644 --- a/supervisord.conf +++ b/supervisord.conf @@ -12,7 +12,7 @@ stdout_logfile=/dev/stdout stdout_logfile_maxbytes=0 stderr_logfile=/dev/stderr stderr_logfile_maxbytes=0 -environment=KVTUBE_DATA_DIR="/app/data",GIN_MODE="release",PORT="8080" +environment=KVTUBE_DATA_DIR="/app/data",GIN_MODE="release",PORT="8080",CORS_ALLOWED_ORIGINS="https://ut.khoavo.myds.me,http://ut.khoavo.myds.me:5011,http://localhost:3000,http://127.0.0.1:3000" [program:frontend] command=node server.js