diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 00000000..f6b18e9f --- /dev/null +++ b/Dockerfile @@ -0,0 +1,12 @@ +FROM python:3.11-alpine + +WORKDIR /app +COPY requirements.txt /app + +# Since alpine doesn't have stable opencc yet, we need to add its testing repo. +# The opencc binary in the testing repo didn't include a libopencc.so.1 file but did include libopencc.so.1.1, +# So linking is necessary +RUN pip install -r requirements.txt \ + && echo "@testing https://dl-cdn.alpinelinux.org/alpine/edge/testing" >> /etc/apk/repositories \ + && apk add --no-cache opencc@testing git \ + && ln -s $(find / -name "libopencc.so.1*" -print -quit) /usr/lib/libopencc.so.1 \ diff --git a/README.md b/README.md index 140e616d..2f5fe77c 100644 --- a/README.md +++ b/README.md @@ -25,8 +25,6 @@ 更新简体文稿之后请手动执行一个脚本生成繁体文稿。(因为 Github Actions 奇怪的问题太多了,还好难测试,还是换成本地构建啦) -构建环境需要 python >= 3.7,可以执行 `pip install -r requirements.txt` 来安装依赖。 - -然后运行 `./scripts/convert_zh.py` 就可以更新繁体了! +构建环境需要安装 docker, 然后 `docker-compose up` 就可以更新繁体了! 这个脚本不会覆盖在已有的繁体文件上的更改,更新已经生成过繁体的简体文稿之后会自动合并,不过还是要手动检查一下哦。 diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 00000000..40ef899e --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,7 @@ +services: + convert: + container_name: oau-convert + build: . + volumes: + - ".:/app" + entrypoint: "./scripts/convert_zh.py" diff --git a/scripts/.convert_past/last-hash.txt b/scripts/.convert_past/last-hash.txt index 0c763966..46a529b5 100644 --- a/scripts/.convert_past/last-hash.txt +++ b/scripts/.convert_past/last-hash.txt @@ -1 +1 @@ -dacf47e2d848513235bda0af91c15e1b18e7cc97 +8f826c393e75c64e393b74ccdca67330c6462e4e