rime-sogou add ghcr.io image

This commit is contained in:
John
2022-09-05 19:21:06 +08:00
parent a608abf2e7
commit efc42a1967
6 changed files with 213 additions and 148 deletions

View File

@ -1,69 +0,0 @@
name: Build rime-sogou-Tags Image
on:
push:
paths:
- '.github/workflows/rime-sogou-Tags-buildx.yml'
workflow_dispatch:
env:
RIME_SOGOU_VER: "1.0"
jobs:
buildx:
runs-on: ubuntu-20.04
steps:
- name: Checkout
uses: actions/checkout@v1
- name: Set up QEMU
id: qemu
uses: docker/setup-qemu-action@v1
with:
platforms: all
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v1
with:
version: latest
- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Build and push
uses: docker/build-push-action@v2
with:
context: ./rime-sogou
file: ./rime-sogou/Dockerfile
platforms: linux/amd64
push: true
tags: johngong/rime-sogou:${{ env.RIME_SOGOU_VER }}_amd64
- name: modify Dockerfile arm64
run: |
sed -i 's/3.1-alpine/3.1-alpine-arm64v8/g' ./rime-sogou/Dockerfile
- name: Build and push
uses: docker/build-push-action@v2
with:
context: ./rime-sogou
file: ./rime-sogou/Dockerfile
platforms: linux/arm64
push: true
tags: johngong/rime-sogou:${{ env.RIME_SOGOU_VER }}_arm64v8
- name: create version tag
run: |
docker buildx imagetools create -t johngong/rime-sogou:${{ env.RIME_SOGOU_VER }} johngong/rime-sogou:${{ env.RIME_SOGOU_VER }}_amd64 johngong/rime-sogou:${{ env.RIME_SOGOU_VER }}_arm64v8
- name: Docker Hub Description
uses: peter-evans/dockerhub-description@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
repository: johngong/rime-sogou
short-description: 自动更新sogou网络流行新词[rime输入法(拼音)]
readme-filepath: ./rime-sogou/README.md

View File

@ -1,67 +0,0 @@
name: Build rime-sogou-latest Image
on:
push:
paths:
- 'rime-sogou/Dockerfile'
- 'rime-sogou/root/**'
workflow_dispatch:
jobs:
buildx:
runs-on: ubuntu-20.04
steps:
- name: Checkout
uses: actions/checkout@v1
- name: Set up QEMU
id: qemu
uses: docker/setup-qemu-action@v1
with:
platforms: all
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v1
with:
version: latest
- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Build and push
uses: docker/build-push-action@v2
with:
context: ./rime-sogou
file: ./rime-sogou/Dockerfile
platforms: linux/amd64
push: true
tags: johngong/rime-sogou:amd64-latest
- name: modify Dockerfile arm64
run: |
sed -i 's/3.1-alpine/3.1-alpine-arm64v8/g' ./rime-sogou/Dockerfile
- name: Build and push
uses: docker/build-push-action@v2
with:
context: ./rime-sogou
file: ./rime-sogou/Dockerfile
platforms: linux/arm64
push: true
tags: johngong/rime-sogou:arm64v8-latest
- name: create latest tag
run: |
docker buildx imagetools create -t johngong/rime-sogou:latest johngong/rime-sogou:amd64-latest johngong/rime-sogou:arm64v8-latest
- name: Docker Hub Description
uses: peter-evans/dockerhub-description@v2
env:
DOCKERHUB_USERNAME: ${{ secrets.DOCKER_USERNAME }}
DOCKERHUB_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
DOCKERHUB_REPOSITORY: johngong/rime-sogou
README_FILEPATH: ./rime-sogou/README.md

188
.github/workflows/rime-sogou.yml vendored Normal file
View File

@ -0,0 +1,188 @@
name: rime-sogou
on:
push:
paths:
- 'rime-sogou/Dockerfile'
- 'rime-sogou/root/**'
workflow_dispatch:
env:
RIME_SOGOU_VER: "1.0"
jobs:
job1:
name: buildx amd64
runs-on: ubuntu-18.04
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Set up QEMU
id: qemu
uses: docker/setup-qemu-action@v2
with:
platforms: all
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v2
with:
version: latest
- name: Login to DockerHub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Login to GHCR
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v2
with:
context: ./rime-sogou
file: ./rime-sogou/Dockerfile
platforms: linux/amd64
push: true
tags: |
johngong/rime-sogou:${{ env.RIME_SOGOU_VER }}_amd64
ghcr.io/gshang2017/rime-sogou:${{ env.RIME_SOGOU_VER }}_amd64
job2:
name: buildx arm64
runs-on: ubuntu-18.04
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Set up QEMU
id: qemu
uses: docker/setup-qemu-action@v2
with:
platforms: all
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v2
with:
version: latest
- name: Login to DockerHub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Login to GHCR
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: modify Dockerfile arm64
run: |
sed -i 's/3.1-alpine/3.1-alpine-arm64v8/g' ./rime-sogou/Dockerfile
- name: Build and push
uses: docker/build-push-action@v2
with:
context: ./rime-sogou
file: ./rime-sogou/Dockerfile
platforms: linux/arm64
push: true
tags: |
johngong/rime-sogou:${{ env.RIME_SOGOU_VER }}_arm64v8
ghcr.io/gshang2017/rime-sogou:${{ env.RIME_SOGOU_VER }}_arm64v8
job3:
needs: [job1, job2]
name: create tags
runs-on: ubuntu-18.04
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Set up QEMU
id: qemu
uses: docker/setup-qemu-action@v2
with:
platforms: all
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v2
with:
version: latest
- name: Login to DockerHub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Login to GHCR
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: create version tag
run: |
docker buildx imagetools create -t johngong/rime-sogou:${{ env.RIME_SOGOU_VER }} \
johngong/rime-sogou:${{ env.RIME_SOGOU_VER }}_amd64 \
johngong/rime-sogou:${{ env.RIME_SOGOU_VER }}_arm64v8
- name: create version tag
run: |
docker buildx imagetools create -t johngong/rime-sogou:amd64-latest \
johngong/rime-sogou:${{ env.RIME_SOGOU_VER }}_amd64
- name: create version tag
run: |
docker buildx imagetools create -t johngong/rime-sogou:arm64v8-latest \
johngong/rime-sogou:${{ env.RIME_SOGOU_VER }}_arm64v8
- name: create version tag
run: |
docker buildx imagetools create -t johngong/rime-sogou:latest \
johngong/rime-sogou:amd64-latest \
johngong/rime-sogou:arm64v8-latest
- name: create version tag(ghcr.io)
run: |
docker buildx imagetools create -t ghcr.io/gshang2017/rime-sogou:amd64-latest \
ghcr.io/gshang2017/rime-sogou:${{ env.RIME_SOGOU_VER }}_amd64
- name: create version tag(ghcr.io)
run: |
docker buildx imagetools create -t ghcr.io/gshang2017/rime-sogou:arm64v8-latest \
ghcr.io/gshang2017/rime-sogou:${{ env.RIME_SOGOU_VER }}_arm64v8
- name: create version tag(ghcr.io)
run: |
docker buildx imagetools create -t ghcr.io/gshang2017/rime-sogou:${{ env.RIME_SOGOU_VER }} \
ghcr.io/gshang2017/rime-sogou:${{ env.RIME_SOGOU_VER }}_amd64 \
ghcr.io/gshang2017/rime-sogou:${{ env.RIME_SOGOU_VER }}_arm64v8
- name: create version tag(ghcr.io)
run: |
docker buildx imagetools create -t ghcr.io/gshang2017/rime-sogou:latest \
ghcr.io/gshang2017/rime-sogou:${{ env.RIME_SOGOU_VER }}_amd64 \
ghcr.io/gshang2017/rime-sogou:${{ env.RIME_SOGOU_VER }}_arm64v8
- name: Docker Hub Description
uses: peter-evans/dockerhub-description@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
repository: johngong/rime-sogou
short-description: 自动更新sogou网络流行新词[rime输入法(拼音)]
readme-filepath: ./rime-sogou/README.md

View File

@ -1,26 +1,32 @@
FROM mcr.microsoft.com/dotnet/runtime:3.1-alpine
ARG S6_VER=2.2.0.3
ARG S6_VER=3.1.2.1
ARG IMEWLCONVERTER_VER=2.9.0
ENV TZ=Asia/Shanghai
ENV SOGOU_DICT_NAME=luna_pinyin.sogou
ENV S6_CMD_WAIT_FOR_SERVICES_MAXTIME=0
COPY root /
COPY --chmod=755 root /
RUN apk add --no-cache bash ca-certificates tzdata py3-requests \
&& apk add --no-cache wqy-zenhei --repository http://dl-2.alpinelinux.org/alpine/edge/testing \
# install s6-overlay
&& if [ "$(uname -m)" = "x86_64" ];then s6_arch=amd64;elif [ "$(uname -m)" = "aarch64" ];then s6_arch=aarch64;elif [ "$(uname -m)" = "armv7l" ];then s6_arch=arm; fi \
&& wget --no-check-certificate https://github.com/just-containers/s6-overlay/releases/download/v${S6_VER}/s6-overlay-${s6_arch}.tar.gz \
&& tar -xvzf s6-overlay-${s6_arch}.tar.gz \
&& if [ "$(uname -m)" = "x86_64" ];then s6_arch=x86_64;elif [ "$(uname -m)" = "aarch64" ];then s6_arch=aarch64;elif [ "$(uname -m)" = "armv7l" ];then s6_arch=arm; fi \
&& wget -P /tmp https://github.com/just-containers/s6-overlay/releases/download/v${S6_VER}/s6-overlay-noarch.tar.xz \
&& tar -C / -Jxpf /tmp/s6-overlay-noarch.tar.xz \
&& wget -P /tmp https://github.com/just-containers/s6-overlay/releases/download/v${S6_VER}/s6-overlay-${s6_arch}.tar.xz \
&& tar -C / -Jxpf /tmp/s6-overlay-${s6_arch}.tar.xz \
&& wget -P /tmp https://github.com/just-containers/s6-overlay/releases/download/v${S6_VER}/s6-overlay-symlinks-noarch.tar.xz \
&& tar -C / -Jxpf /tmp/s6-overlay-symlinks-noarch.tar.xz \
&& wget -P /tmp https://github.com/just-containers/s6-overlay/releases/download/v${S6_VER}/s6-overlay-symlinks-arch.tar.xz \
&& tar -C / -Jxpf /tmp/s6-overlay-symlinks-arch.tar.xz \
# install imewlconverter
&& wget -P / https://github.com/studyzy/imewlconverter/releases/download/v${IMEWLCONVERTER_VER}/imewlconverter_Linux_Mac.tar.gz \
&& tar -xvf /imewlconverter_Linux_Mac.tar.gz -C /usr/local/bin \
&& wget -P /tmp https://github.com/studyzy/imewlconverter/releases/download/v${IMEWLCONVERTER_VER}/imewlconverter_Linux_Mac.tar.gz \
&& mkdir -p /usr/local/imewlconverter \
&& tar -xvf /tmp/imewlconverter_Linux_Mac.tar.gz -C /usr/local/imewlconverter \
# clear
&& rm -rf /var/cache/apk/* \
&& rm /s6-overlay-${s6_arch}.tar.gz \
&& rm /imewlconverter_Linux_Mac.tar.gz
&& rm -rf /var/cache/apk/* /tmp/*
VOLUME /output
ENTRYPOINT [ "/init" ]

View File

@ -5,6 +5,10 @@
自动更新sogou网络流行新词 <https://pinyin.sogou.com/dict/detail/index/4> ,生成rime输入法(拼音)使用文件luna_pinyin.sogou.dict.yaml(默认名称)。
### GitHub:
[https://github.com/gshang2017/docker](https://github.com/gshang2017/docker)
### 感谢以下项目:
[https://github.com/studyzy/imewlconverter](https://github.com/studyzy/imewlconverter)
@ -19,7 +23,10 @@
1. 下载镜像
docker pull johngong/rime-sogou:latest
|镜像源|命令|
|:-|:-|
|DockerHub|docker pull johngong/rime-sogou:latest|
|GitHub|docker pull ghcr.io/gshang2017/rime-sogou:latest|
2. 创建qbittorrent容器

View File

@ -56,7 +56,7 @@ if dict_name is None:
elif len(dict_name) == 0:
dict_name = 'luna_pinyin.sogou'
scel_output_file = '{name}.dict.yaml'.format(name=dict_name)
command='''dotnet /usr/local/bin/ImeWlConverterCmd.dll -i:scel %s -ft:"rm:eng|rm:num|rm:space|rm:pun" -o:rime "%s"''' % (str(scel_md5_file).strip('[]').replace(',',''),scel_output_file)
command='''dotnet /usr/local/imewlconverter/ImeWlConverterCmd.dll -i:scel %s -ft:"rm:eng|rm:num|rm:space|rm:pun" -o:rime "%s"''' % (str(scel_md5_file).strip('[]').replace(',',''),scel_output_file)
os.system(command)
#完善yaml文件输出格式