Skip to content

Commit 1e39e1a

Browse files
ci: Adds workflow to publish docker builds (#377)
1 parent c9c1b84 commit 1e39e1a

File tree

2 files changed

+54
-0
lines changed

2 files changed

+54
-0
lines changed
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
name: Build And Push Docker Image
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
env:
9+
DOCKER_REGISTRY: "quay.io"
10+
DOCKER_NAMESPACE: "unstructured-io"
11+
IMAGE_PLATFORMS: linux/amd64
12+
PACKAGE: "unstructured"
13+
PIP_VERSION: "22.2.1"
14+
BUILD_TYPE_TAG_SUFFIX: ""
15+
16+
jobs:
17+
build:
18+
runs-on: ubuntu-latest
19+
steps:
20+
- name: Checkout code
21+
uses: actions/checkout@v3
22+
23+
- name: Set up QEMU
24+
uses: docker/setup-qemu-action@v1
25+
26+
- name: Set up Docker Buildx
27+
uses: docker/setup-buildx-action@v1
28+
29+
- name: Login to Quay.io
30+
uses: docker/login-action@v1
31+
with:
32+
registry: quay.io
33+
username: ${{ secrets.QUAY_IO_ROBOT_USERNAME }}
34+
password: ${{ secrets.QUAY_IO_ROBOT_TOKEN }}
35+
36+
# TODO(rniko): add a step to test the built image before pushing. Will add after https://unstructured-ai.atlassian.net/browse/CORE-745 is done
37+
- name: Build and push Docker image
38+
run: |
39+
VERSION=$(grep -Po '(?<=__version__ = ")[^"]*' unstructured/__version__.py)
40+
GIT_SHA=$(git rev-parse --short HEAD)
41+
IMAGE_NAME=${{ env.PACKAGE }}
42+
docker buildx build --platform=${{ env.IMAGE_PLATFORMS }} --provenance=false --push \
43+
--build-arg PIP_VERSION=${{ env.PIP_VERSION }} \
44+
-t ${{ env.DOCKER_REGISTRY }}/${{ env.DOCKER_NAMESPACE }}/${IMAGE_NAME}:${GIT_SHA} \
45+
-t ${{ env.DOCKER_REGISTRY }}/${{ env.DOCKER_NAMESPACE }}/${IMAGE_NAME}:${VERSION} \
46+
-t ${{ env.DOCKER_REGISTRY }}/${{ env.DOCKER_NAMESPACE }}/${IMAGE_NAME}:latest .

Dockerfile

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,12 @@ ARG UNSTRUCTURED
88
RUN yum -y update && \
99
yum -y install poppler-utils xz-devel which
1010

11+
# Enable the EPEL repository
12+
RUN yum install -y epel-release && yum clean all
13+
14+
# Install pandoc
15+
RUN yum install -y pandoc && yum clean all
16+
1117
# Note(austin) Get a recent tesseract from this repo
1218
# See https://tesseract-ocr.github.io/tessdoc/Installation.html
1319
# PDF and images:
@@ -44,6 +50,7 @@ ENV PATH="/home/usr/.local/bin:${PATH}"
4450
COPY example-docs example-docs
4551

4652
COPY requirements/base.txt requirements-base.txt
53+
COPY requirements/test.txt requirements-test.txt
4754
COPY requirements/huggingface.txt requirements-huggingface.txt
4855
COPY requirements/dev.txt requirements-dev.txt
4956
# PDFs and images
@@ -52,6 +59,7 @@ COPY requirements/local-inference.txt requirements-local-inference.txt
5259

5360
RUN python3.8 -m pip install pip==${PIP_VERSION} \
5461
&& pip install --no-cache -r requirements-base.txt \
62+
&& pip install --no-cache -r requirements-test.txt \
5563
&& pip install --no-cache -r requirements-huggingface.txt \
5664
&& pip install --no-cache -r requirements-dev.txt \
5765
# PDFs and images

0 commit comments

Comments
 (0)