Skip to content

Commit e8c6fa9

Browse files
fix: build and push workflow failing due to missing -f option buildx build command (#425)
I noticed that images on main branch are failing to build (and push) due to missing `-f` parameter in `docker buildx build`. By default it expects `Dockerfile` to exist, but we only have `Dockerfile-amd64` and `Dockerfile-arm64` ![image](https://github.com/Unstructured-IO/unstructured-api/assets/64484917/4527165a-909e-498d-b0ee-8bba4b1a13e4) --------- Co-authored-by: christinestraub <[email protected]>
1 parent 2bdd52a commit e8c6fa9

File tree

2 files changed

+12
-14
lines changed

2 files changed

+12
-14
lines changed

.github/workflows/docker-publish.yml

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -45,16 +45,17 @@ jobs:
4545
build-images:
4646
strategy:
4747
matrix:
48-
docker-platform: ["linux/arm64", "linux/amd64"]
48+
arch: ["arm64", "amd64"]
4949
runs-on: ubuntu-latest-m
5050
needs: [setup, set-short-sha]
5151
env:
5252
SHORT_SHA: ${{ needs.set-short-sha.outputs.short_sha }}
53+
DOCKER_PLATFORM: linux/${{ matrix.arch }}
5354
steps:
5455
- name: Set up Docker Buildx
5556
uses: docker/setup-buildx-action@v3
5657
with:
57-
driver: ${{ matrix.docker-platform == 'linux/amd64' && 'docker' || 'docker-container' }}
58+
driver: ${{ matrix.arch == 'amd64' && 'docker' || 'docker-container' }}
5859
- name: Checkout code
5960
uses: actions/checkout@v4
6061
- name: Login to Quay.io
@@ -68,15 +69,15 @@ jobs:
6869
# Clear some space (https://github.com/actions/runner-images/issues/2840)
6970
sudo rm -rf /usr/share/dotnet /opt/ghc /usr/local/share/boost
7071
71-
ARCH=$(cut -d "/" -f2 <<< ${{ matrix.docker-platform }})
72-
DOCKER_BUILDKIT=1 docker buildx build --platform=$ARCH --load \
72+
DOCKER_BUILDKIT=1 docker buildx build --load -f Dockerfile-${{ matrix.arch }} \
73+
--platform=$DOCKER_PLATFORM \
7374
--build-arg PIP_VERSION=$PIP_VERSION \
7475
--build-arg BUILDKIT_INLINE_CACHE=1 \
7576
--build-arg PIPELINE_PACKAGE=${{ env.PIPELINE_FAMILY }} \
7677
--provenance=false \
7778
--progress plain \
78-
--cache-from $DOCKER_BUILD_REPOSITORY:$ARCH \
79-
-t $DOCKER_BUILD_REPOSITORY:$ARCH-$SHORT_SHA .
79+
--cache-from $DOCKER_BUILD_REPOSITORY:${{ matrix.arch }} \
80+
-t $DOCKER_BUILD_REPOSITORY:${{ matrix.arch }}-$SHORT_SHA .
8081
- name: Set virtualenv cache
8182
uses: actions/cache@v4
8283
id: virtualenv-cache
@@ -88,20 +89,17 @@ jobs:
8889
uses: docker/setup-qemu-action@v3
8990
- name: Test image
9091
run: |
91-
ARCH=$(cut -d "/" -f2 <<< ${{ matrix.docker-platform }})
9292
source .venv/bin/activate
93-
if [ "${{ matrix.docker-platform }}" == "linux/arm64" ]; then
94-
DOCKER_PLATFORM="${{ matrix.docker-platform }}" DOCKER_IMAGE="$DOCKER_BUILD_REPOSITORY:$ARCH-$SHORT_SHA" \
93+
DOCKER_IMAGE="$DOCKER_BUILD_REPOSITORY:${{ matrix.arch }}-$SHORT_SHA" \
94+
if [ "$DOCKER_PLATFORM" == "linux/arm64" ]; then
9595
SKIP_INFERENCE_TESTS=true make docker-test
9696
else
97-
DOCKER_PLATFORM="${{ matrix.docker-platform }}" DOCKER_IMAGE="$DOCKER_BUILD_REPOSITORY:$ARCH-$SHORT_SHA" \
9897
make docker-test
9998
fi
10099
- name: Push image
101100
run: |
102101
# write to the build repository to cache for the publish-images job
103-
ARCH=$(cut -d "/" -f2 <<< ${{ matrix.docker-platform }})
104-
docker push $DOCKER_BUILD_REPOSITORY:$ARCH-$SHORT_SHA
102+
docker push $DOCKER_BUILD_REPOSITORY:${{ matrix.arch }}-$SHORT_SHA
105103
publish-images:
106104
runs-on: ubuntu-latest-m
107105
needs: [setup, set-short-sha, build-images]

Dockerfile-amd64

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# syntax=docker/dockerfile:experimental
2-
FROM quay.io/unstructured-io/base-images:wolfi-base@sha256:6c00a236c648ffdaf196ccbc446f5c6cc9eb4e3ab9e437178abcfac710b2b373 as base
2+
FROM quay.io/unstructured-io/base-images:wolfi-base@sha256:863fd5b87e780dacec62b97c2db2aeda7f770fcf9b045b29f53ec1ddbe607b4d as base
33

44
# NOTE(crag): NB_USER ARG for mybinder.org compat:
55
# https://mybinder.readthedocs.io/en/latest/tutorials/dockerfile.html
@@ -39,4 +39,4 @@ COPY --chown=${NB_USER}:${NB_USER} scripts/app-start.sh scripts/app-start.sh
3939
ENTRYPOINT ["scripts/app-start.sh"]
4040
# Expose a default port of 8000. Note: The EXPOSE instruction does not actually publish the port,
4141
# but some tooling will inspect containers and perform work contingent on networking support declared.
42-
EXPOSE 8000
42+
EXPOSE 8000

0 commit comments

Comments
 (0)