forked from Unstructured-IO/unstructured
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ci: Adds workflow to publish docker builds (Unstructured-IO#377)
- Loading branch information
1 parent
c9c1b84
commit 1e39e1a
Showing
2 changed files
with
54 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
name: Build And Push Docker Image | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
|
||
env: | ||
DOCKER_REGISTRY: "quay.io" | ||
DOCKER_NAMESPACE: "unstructured-io" | ||
IMAGE_PLATFORMS: linux/amd64 | ||
PACKAGE: "unstructured" | ||
PIP_VERSION: "22.2.1" | ||
BUILD_TYPE_TAG_SUFFIX: "" | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
|
||
- name: Set up QEMU | ||
uses: docker/setup-qemu-action@v1 | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v1 | ||
|
||
- name: Login to Quay.io | ||
uses: docker/login-action@v1 | ||
with: | ||
registry: quay.io | ||
username: ${{ secrets.QUAY_IO_ROBOT_USERNAME }} | ||
password: ${{ secrets.QUAY_IO_ROBOT_TOKEN }} | ||
|
||
# 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 | ||
- name: Build and push Docker image | ||
run: | | ||
VERSION=$(grep -Po '(?<=__version__ = ")[^"]*' unstructured/__version__.py) | ||
GIT_SHA=$(git rev-parse --short HEAD) | ||
IMAGE_NAME=${{ env.PACKAGE }} | ||
docker buildx build --platform=${{ env.IMAGE_PLATFORMS }} --provenance=false --push \ | ||
--build-arg PIP_VERSION=${{ env.PIP_VERSION }} \ | ||
-t ${{ env.DOCKER_REGISTRY }}/${{ env.DOCKER_NAMESPACE }}/${IMAGE_NAME}:${GIT_SHA} \ | ||
-t ${{ env.DOCKER_REGISTRY }}/${{ env.DOCKER_NAMESPACE }}/${IMAGE_NAME}:${VERSION} \ | ||
-t ${{ env.DOCKER_REGISTRY }}/${{ env.DOCKER_NAMESPACE }}/${IMAGE_NAME}:latest . |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters