Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
a76yyyy authored Jan 30, 2025
0 parents commit 600da6e
Show file tree
Hide file tree
Showing 5 changed files with 160 additions and 0 deletions.
62 changes: 62 additions & 0 deletions .github/workflows/Build Image.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
name: Publish Package
on:
workflow_dispatch: {}
push:
paths-ignore:
- '.github/**'
- '**.md'
tags: ["*"]

jobs:
build:
runs-on: ubuntu-latest
name: Publish Package job


steps:
-
name: Checkout
uses: actions/checkout@v4
-
name: Set up QEMU
uses: docker/setup-qemu-action@v3
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
-
id: login-ghcr
name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }} # dockerServer Username 在setting创建secrets name=DOCKER_USERNAME value=dockerid
password: ${{ secrets.GITHUB_TOKEN }} # dockerServer Token
continue-on-error: true
-
id: login-dockerhub
name: Login to DockerHub
uses: docker/login-action@v3
with:
registry: docker.io
username: ${{ secrets.DOCKER_USERNAME }} # dockerServer Username 在setting创建secrets name=DOCKER_USERNAME value=dockerid
password: ${{ secrets.DOCKER_PASSWORD }} # dockerServer Token 在setting创建secrets name=DOCKER_PASSWORD value=dockerToken
continue-on-error: true
-
id: meta
name: Docker meta
uses: docker/metadata-action@v5
with:
images: |
name=ghcr.io/${{ github.repository_owner }}/ddddocr,enable=${{ steps.login-ghcr.outcome == 'success' }}
name=docker.io/a76yyyy/ddddocr,enable=${{ steps.login-dockerhub.outcome == 'success' }}
tags: |
type=ref,event=tag
-
name: Publish Latest Package
uses: docker/build-push-action@v5
with:
context: .
file: ./Dockerfile
platforms: linux/386,linux/arm64,linux/amd64,linux/arm/v6,linux/arm/v7,linux/ppc64le,linux/s390x # 你准备构建的镜像平台
push: true
tags: ${{ steps.meta.outputs.tags }}
22 changes: 22 additions & 0 deletions .github/workflows/DockerHub-Description.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: Update Docker Hub Description
on:
push:
branches:
- main
paths:
- README.md
- .github/workflows/DockerHub-Description.yml
jobs:
dockerHubDescription:
if: startsWith(github.repository, 'qd-today/ddddocr-docker')
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

- name: Docker Hub Description
uses: peter-evans/dockerhub-description@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}
repository: a76yyyy/ddddocr
short-description: ${{ github.event.repository.description }}
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
.vscode
.history
.python-version
venv
.lh
51 changes: 51 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# 基础镜像
FROM alpine:edge

# 维护者信息
LABEL maintainer "a76yyyy <[email protected]>"
LABEL org.opencontainers.image.source=https://github.com/qd-today/ddddocr-docker
ARG TARGETPLATFORM

ARG APK_MIRROR="" #e.g., https://mirrors.tuna.tsinghua.edu.cn
ARG PIP_MIRROR="" #e.g., https://pypi.tuna.tsinghua.edu.cn/simple
ARG GIT_DOMAIN=https://github.com #e.g., https://gh-proxy.com/https://github.com or https://gitee.com

# Envirenment for dddocr
ARG DDDDOCR_VERSION=master
# ENV DDDDOCR_VERSION=${DDDDOCR_VERSION}

# Install packages
RUN <<EOT
#!/usr/bin/env sh
set -eux
echo 'https://dl-cdn.alpinelinux.org/alpine/edge/testing' >> /etc/apk/repositories
APK_CMD="apk"
if [ "x" != "x${APK_MIRROR}" ]; then
APK_CMD="apk --repositories-file=/dev/null -X $APK_MIRROR/alpine/edge/main -X $APK_MIRROR/alpine/edge/community -X $APK_MIRROR/alpine/edge/testing"
fi
$APK_CMD update
$APK_CMD add --update --no-cache bash git tzdata ca-certificates file python3 py3-six
# ln -s /usr/bin/python3 /usr/bin/python
if [ "${TARGETPLATFORM}" = "linux/amd64" ] || [ "${TARGETPLATFORM}" = "linux/arm64" ] || [ "${TARGETPLATFORM}" = "linux/arm/v7" ]; then
$APK_CMD add --update --no-cache py3-pillow py3-onnxruntime py3-opencv libprotobuf-lite
$APK_CMD add --update --no-cache --virtual .build_deps py3-pip py3-setuptools py3-wheel \
protobuf-dev py3-numpy-dev lld samurai build-base gcc python3-dev musl-dev linux-headers make
git clone --branch $DDDDOCR_VERSION --depth 1 $GIT_DOMAIN/sml2h3/ddddocr.git
cd /ddddocr
sed -i '/install_package_data/d' setup.py
sed -i '/install_requires/d' setup.py
sed -i '/python_requires/d' setup.py
PIP_INSTALL="pip install"
if [ "x" != "x$PIP_MIRROR" ]; then
PIP_INSTALL="pip install --index-url $PIP_MIRROR"
fi
$PIP_INSTALL --no-cache-dir --compile --break-system-packages .
cd / && rm -rf /ddddocr
$APK_CMD del .build_deps;
else
$APK_CMD add --update --no-cache libprotobuf-lite
echo "py3-pillow/py3-onnxruntime/py3-opencv does not currently support ${TARGETPLATFORM}."
fi
rm -rf /var/cache/apk/*
rm -rf /usr/share/man/*
EOT
20 changes: 20 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# **ddddocr-Docker**

## **Repository**

**Github :** [https://github.com/qd-today/ddddocr-docker](https://github.com/qd-today/ddddocr-docker)

**DockerHub :** [https://hub.docker.com/r/a76yyyy/ddddocr](https://hub.docker.com/r/a76yyyy/ddddocr)

```bash
docker pull a76yyyy/ddddocr:latest
```

## **VERSION**

- PYTHON_VERSION == 3.11
- DDDDOCR_VERSION == LATEST(v1.4.7)

## **Tips**

> Onnxruntime Builder does not currently support building i386 and s390x wheels!

0 comments on commit 600da6e

Please sign in to comment.