commit caaa113e0e68b87bae87eecde705aaa6d5b0e282 Author: sudacode Date: Thu Sep 4 00:56:04 2025 -0700 initial commit diff --git a/.gitea/workflows/docker-build-push.yml b/.gitea/workflows/docker-build-push.yml new file mode 100644 index 0000000..65dbe3c --- /dev/null +++ b/.gitea/workflows/docker-build-push.yml @@ -0,0 +1,65 @@ +name: Build and Push Docker Image + +on: + push: + branches: + - "release/*" + tags: + - "*" + workflow_dispatch: + +jobs: + docker: + runs-on: ubuntu-latest + if: ${{ !contains(github.event.head_commit.message, '[skip ci]') }} + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + # Ensure full history and all tags are available + fetch-depth: 0 + + - name: Set up QEMU (multi-arch) + uses: docker/setup-qemu-action@v3 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Docker meta + id: meta + uses: docker/metadata-action@v5 + with: + images: gitea.suda.codes/${{ github.repository }} + tags: | + type=ref,event=tag + + - name: Determine latest Git tag + id: latest + shell: bash + run: | + set -euo pipefail + # Fetch tags in case the runner's mirror is stale + git fetch --tags --force --quiet || true + if tag=$(git describe --tags --abbrev=0 2>/dev/null); then + echo "tag=$tag" >> "$GITHUB_OUTPUT" + else + # Fallback when no tags exist + echo "tag=latest" >> "$GITHUB_OUTPUT" + fi + + - name: Log in to container registry + uses: docker/login-action@v3 + with: + registry: gitea.suda.codes + username: ${{ secrets.REGISTRY_USERNAME }} + password: ${{ secrets.REGISTRY_PASSWORD }} + + - name: Build and push + uses: docker/build-push-action@v6 + with: + context: . + push: true + # Always tag with the latest Git tag; also keep any tags from metadata (e.g., on tag events) + tags: | + ${{ steps.meta.outputs.tags }} + gitea.suda.codes/${{ github.repository }}:${{ steps.latest.outputs.tag }} diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..f911760 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,20 @@ +FROM python:3.12-slim + +RUN apt-get update \ + && apt-get install -y --no-install-recommends \ + libgl1 \ + libglib2.0-0 \ + && rm -rf /var/lib/apt/lists/* + +RUN pip install --no-cache-dir --upgrade torch torchvision mokuro + +# create a user to run the application +RUN useradd -m mokurouser \ + && mkdir -p /home/mokurouser/mokuro \ + && chown -R mokurouser:mokurouser /home/mokurouser + +WORKDIR /home/mokurouser + +COPY . . + +CMD ["/bin/sh", "run.sh"] diff --git a/compose.yaml b/compose.yaml new file mode 100644 index 0000000..939d0e4 --- /dev/null +++ b/compose.yaml @@ -0,0 +1,27 @@ +--- +services: + mokuro: + image: gitea.suda.codes/sudacode/mokuro-docker:latest + build: + context: . + dockerfile: Dockerfile + container_name: mokuro + user: 1000:1000 + volumes: + - /home/sudacode/S/japanese/manga/One Piece color v01-05:/home/mokurouser/mokuro + runtime: nvidia + restart: never + network_mode: host + deploy: + resources: + reservations: + devices: + - driver: nvidia + count: 1 + capabilities: + - gpu + - compute + - video + environment: + - NVIDIA_DRIVER_CAPABILITIES=all + - NVIDIA_VISIBLE_DEVICES=all diff --git a/run.sh b/run.sh new file mode 100755 index 0000000..aa15185 --- /dev/null +++ b/run.sh @@ -0,0 +1,5 @@ +#!/usr/bin/env bash + +cd /home/mokurouser/mokuro || exit +rm -rf _ocr *.html +mokuro --disable_html --disable_confirmation --parent_dir One\ Piece\ Color