From a7b36929822d10b89118056ac6a63d1b9e01d251 Mon Sep 17 00:00:00 2001 From: MythEclipse Date: Mon, 1 Jun 2026 10:53:20 +0700 Subject: [PATCH] feat(docker): update Docker configuration and add build workflow --- .github/workflows/docker-publish.yml | 54 ++++++++++++++++++++++++++++ .github/workflows/notify-parent.yml | 24 ------------- Dockerfile | 35 ++++++++++++++++++ docker-compose.yml | 2 +- 4 files changed, 90 insertions(+), 25 deletions(-) create mode 100644 .github/workflows/docker-publish.yml delete mode 100644 .github/workflows/notify-parent.yml create mode 100644 Dockerfile diff --git a/.github/workflows/docker-publish.yml b/.github/workflows/docker-publish.yml new file mode 100644 index 0000000..50a8d32 --- /dev/null +++ b/.github/workflows/docker-publish.yml @@ -0,0 +1,54 @@ +name: Build and Push Docker Image + +on: + push: + branches: + - main + - master + tags: + - "v*" + workflow_dispatch: + +env: + GHCR_IMAGE: ghcr.io/mytheclipse/gmw + +jobs: + build-and-push: + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + + steps: + - uses: actions/checkout@v6 + + - uses: docker/setup-buildx-action@v4 + + - name: Log in to GHCR + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Extract metadata + id: meta + uses: docker/metadata-action@v5 + with: + images: ${{ env.GHCR_IMAGE }} + tags: | + type=raw,value=latest + type=ref,event=tag + type=sha,prefix=sha- + + - name: Build and push + uses: docker/build-push-action@v7 + with: + context: . + push: true + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} + cache-from: type=registry,ref=${{ env.GHCR_IMAGE }}:buildcache + cache-to: type=registry,ref=${{ env.GHCR_IMAGE }}:buildcache,mode=max + provenance: false + sbom: false \ No newline at end of file diff --git a/.github/workflows/notify-parent.yml b/.github/workflows/notify-parent.yml deleted file mode 100644 index 604a46b..0000000 --- a/.github/workflows/notify-parent.yml +++ /dev/null @@ -1,24 +0,0 @@ -name: Notify Parent Repo - -on: - push: - branches: - - master - -jobs: - dispatch: - runs-on: ubuntu-latest - steps: - - name: Trigger monorepo build - uses: peter-evans/repository-dispatch@v3 - with: - token: ${{ secrets.DISPATCH_TOKEN }} - repository: MythEclipse/ultimate-asepharyana.tech - event-type: submodule-updated - client-payload: | - { - "service": "gmw", - "ref": "${{ github.ref }}", - "sha": "${{ github.sha }}", - "actor": "${{ github.actor }}" - } diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..eca79c6 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,35 @@ +FROM node:22-bookworm-slim + +# Runtime deps: ffmpeg for video muxing, yt-dlp for download, build tools for node-canvas +RUN apt-get update && apt-get install -y --no-install-recommends \ + ffmpeg \ + python3 \ + curl \ + ca-certificates \ + git \ + make \ + g++ \ + && rm -rf /var/lib/apt/lists/* + +# yt-dlp +RUN curl -L https://github.com/yt-dlp/yt-dlp/releases/latest/download/yt-dlp \ + -o /usr/local/bin/yt-dlp && chmod a+rx /usr/local/bin/yt-dlp + +RUN corepack enable + +WORKDIR /app + +# Install deps from the app-local build context. +COPY package.json pnpm-lock.yaml pnpm-workspace.yaml* ./ +COPY vendor/discord-video-stream/package.json ./vendor/discord-video-stream/ +COPY vendor/discord.js-selfbot-v13/package.json ./vendor/discord.js-selfbot-v13/ +RUN pnpm install --no-frozen-lockfile + +COPY . . + +RUN pnpm run prepare:vendor +RUN pnpm run build + +ENV NODE_ENV=production + +CMD ["pnpm", "run", "start"] \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml index d527b46..757dd35 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,7 +1,7 @@ services: app: build: . - image: ${IMAGE_NAME:-ghcr.io/mytheclipse/bete:latest} + image: ${IMAGE_NAME:-ghcr.io/mytheclipse/gmw:latest} container_name: imphenbot-app restart: unless-stopped env_file: