diff --git a/.docker/Dockerfile b/.docker/Dockerfile index 2378adb3..89cc336f 100644 --- a/.docker/Dockerfile +++ b/.docker/Dockerfile @@ -10,8 +10,10 @@ RUN apt-get update && apt-get install -y --no-install-recommends \ build-essential autoconf automake libtool \ libleptonica-dev \ zlib1g-dev \ - python3 \ + python3-dev \ python3-distutils \ + libffi-dev \ + libqpdf-dev \ ca-certificates \ curl \ git @@ -62,7 +64,8 @@ RUN apt-get update && apt-get install -y --no-install-recommends \ tesseract-ocr-fra \ tesseract-ocr-por \ tesseract-ocr-spa \ - unpaper + unpaper \ + && rm -rf /var/lib/apt/lists/* WORKDIR /app diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index cd4cf868..e45fc839 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -225,3 +225,49 @@ jobs: user: __token__ password: ${{ secrets.TOKEN_PYPI }} # repository_url: https://test.pypi.org/legacy/ + + docker: + name: Build Docker images + needs: [wheel_sdist_linux, test_linux, test_macos, test_windows] + runs-on: ubuntu-latest + steps: + - name: Set image tag to release or branch + run: echo "DOCKER_IMAGE_TAG=${GITHUB_REF##*/}" >> $GITHUB_ENV + + - name: If master, set to latest + run: echo 'DOCKER_IMAGE_TAG=latest' >> $GITHUB_ENV + if: env.DOCKER_IMAGE_TAG == 'master' + + - name: Set Docker Hub repository to username + run: echo "DOCKER_REPOSITORY=jbarlow83" >> $GITHUB_ENV + + - name: Set image name + run: echo "DOCKER_IMAGE_NAME=ocrmypdf" >> $GITHUB_ENV + + - uses: actions/checkout@v2 + with: + fetch-depth: "0" # 0=all, needed for setuptools-scm to resolve version tags + + - name: Login to Docker Hub + uses: docker/login-action@v1 + with: + username: jbarlow83 + password: ${{ secrets.DOCKERHUB_TOKEN }} + + - name: Set up QEMU + uses: docker/setup-qemu-action@v1 + + - name: Set up Docker Buildx + id: buildx + uses: docker/setup-buildx-action@v1 + + - name: Print image tag + run: echo "Building image ${DOCKER_REPOSITORY}/${DOCKER_IMAGE_NAME}:${DOCKER_IMAGE_TAG}" + + - name: Build + run: | + docker buildx build \ + --push \ + --platform linux/arm64/v8,linux/amd64 \ + --tag "${DOCKER_REPOSITORY}/${DOCKER_IMAGE_NAME}:${DOCKER_IMAGE_TAG}" \ + --file .docker/Dockerfile .