11 Commits

Author SHA1 Message Date
Renovate Bot
7127a9c28f Add renovate.json 2025-09-20 07:34:22 +00:00
5a53e1a782 replace zip with run script 2025-09-07 15:08:12 -07:00
b0e430e19d update command 2025-09-07 04:28:29 -07:00
383af5a61e update run script 2025-09-07 04:24:29 -07:00
67593cc678 add cleanup for legacy .html files 2025-09-07 03:43:37 -07:00
4570d10238 update zip script 2025-09-07 03:32:01 -07:00
c05cd29028 update script path 2025-09-07 02:50:45 -07:00
a62a960ebd update zip script 2025-09-07 02:24:05 -07:00
23a6d9d18e update command 2025-09-07 02:15:56 -07:00
30a7c3194d remove workflow 2025-09-04 21:41:54 -07:00
d61913646d update
Some checks failed
Build and Push Docker Image / docker (push) Failing after 13m9s
2025-09-04 02:05:35 -07:00
5 changed files with 66 additions and 76 deletions

View File

@@ -1,65 +0,0 @@
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 }}

View File

@@ -1,20 +1,34 @@
FROM python:3.12-slim FROM python:3.12-slim
# Install dependencies + locales
RUN apt-get update \ RUN apt-get update \
&& apt-get install -y --no-install-recommends \ && apt-get install -y --no-install-recommends \
libgl1 \ libgl1 \
libglib2.0-0 \ libglib2.0-0 \
p7zip-full \
locales \
fonts-noto-cjk \
&& rm -rf /var/lib/apt/lists/* && rm -rf /var/lib/apt/lists/*
# Generate Japanese UTF-8 locale
RUN sed -i '/ja_JP.UTF-8/s/^# //g' /etc/locale.gen \
&& locale-gen
# Set environment variables for locale
ENV LANG=ja_JP.UTF-8 \
LANGUAGE=ja_JP:ja \
LC_ALL=ja_JP.UTF-8 \
LC_CTYPE=ja_JP.UTF-8
RUN pip install --no-cache-dir --upgrade torch torchvision mokuro RUN pip install --no-cache-dir --upgrade torch torchvision mokuro
# create a user to run the application # create a user to run the application
RUN useradd -m mokurouser \ RUN useradd -m mokurouser \
&& mkdir -p /home/mokurouser/mokuro \ && mkdir -p /mokuro \
&& chown -R mokurouser:mokurouser /home/mokurouser && chown -R mokurouser:mokurouser /mokuro
WORKDIR /home/mokurouser WORKDIR /mokuro
USER mokurouser
COPY . . COPY . .
CMD ["/bin/sh", "run.sh"]

View File

@@ -1,17 +1,19 @@
--- ---
services: services:
mokuro: mokuro:
image: gitea.suda.codes/sudacode/mokuro-docker:latest image: mokuro
build: build:
context: . context: .
dockerfile: Dockerfile dockerfile: Dockerfile
container_name: mokuro container_name: mokuro
user: 1000:1000 user: 1000:1000
volumes: volumes:
- /home/sudacode/S/japanese/manga/One Piece color v01-05:/home/mokurouser/mokuro - ~/S/japanese/manga:/mokuro/manga
command: ./run.sh "manga/One Piece Color"
runtime: nvidia runtime: nvidia
restart: never restart: no
network_mode: host network_mode: host
tty: true
deploy: deploy:
resources: resources:
reservations: reservations:

6
renovate.json Normal file
View File

@@ -0,0 +1,6 @@
{
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
"extends": [
"config:recommended"
]
}

39
run.sh
View File

@@ -1,5 +1,38 @@
#!/usr/bin/env bash #!/usr/bin/env bash
cd /home/mokurouser/mokuro || exit set -Eeuo pipefail
rm -rf _ocr *.html export LANG=ja_JP.UTF-8
mokuro --disable_html --disable_confirmation --parent_dir One\ Piece\ Color export LANGUAGE=ja_JP:ja
export LC_ALL=ja_JP.UTF-8
export LC_CTYPE=ja_JP.UTF-8
DIR="${1:-.}"
if [[ ! -d "$DIR" ]]; then
echo "Error: Directory '$DIR' does not exist."
exit 1
fi
if ! mokuro --parent_dir "$DIR" --disable_confirmation; then
echo "Error: mokuro command failed."
exit 1
fi
cd "$DIR" || exit
for f in *.mokuro; do
[[ -e "$f" ]] || continue
base="${f%.mokuro}"
dir="$base"
zipfile="$base.zip"
if [[ -f "$zipfile" ]]; then
echo "Warning: Zip file $zipfile already exists, skipping."
elif [[ -d "$dir" ]]; then
echo "Zipping: $zipfile <- $f $dir/"
7z a -tzip "$zipfile" "$f" "$dir"
else
echo "Warning: Directory '$dir' not found for '$f', skipping."
fi
done
rm -rf ./*.html