chore: build with registry as cache (#454)

This commit is contained in:
ryannikolaidis 2023-04-06 00:34:07 -07:00 committed by GitHub
parent 9b5cae49e1
commit ef9fb79ed4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 23 additions and 10 deletions

View File

@ -1,7 +1,9 @@
## 0.5.12-dev0
## 0.5.12-dev1
### Enhancements
* Use the image registry as a cache when building Docker images.
### Features
### Fixes

View File

@ -186,24 +186,23 @@ check-coverage:
# Docker targets are provided for convenience only and are not required in a standard development environment
DOCKER_PLATFORM ?= linux/amd64
DOCKER_IMAGE ?= unstructured-dev:latest
DOCKER_IMAGE ?= unstructured:dev
.PHONY: docker-build
docker-build:
PIP_VERSION=${PIP_VERSION} ./scripts/docker-build.sh
PIP_VERSION=${PIP_VERSION} DOCKER_IMAGE_NAME=${DOCKER_IMAGE} ./scripts/docker-build.sh
.PHONY: docker-start-bash
docker-start-bash:
docker run --platform $(DOCKER_PLATFORM) -ti --rm $(DOCKER_IMAGE)
docker run -ti --rm ${DOCKER_IMAGE}
.PHONY: docker-test
docker-test:
docker run --platform $(DOCKER_PLATFORM) --rm \
docker run --rm \
-v ${CURRENT_DIR}/test_unstructured:/home/test_unstructured \
$(DOCKER_IMAGE) \
bash -c "pytest $(if $(TEST_NAME),-k $(TEST_NAME),) test_unstructured"
.PHONY: docker-smoke-test
docker-smoke-test:
./scripts/docker-smoke-test.sh
IMAGE_NAME=${DOCKER_IMAGE} ./scripts/docker-smoke-test.sh

View File

@ -1,8 +1,20 @@
#!/bin/bash
set -euo pipefail
DOCKER_REPOSITORY="${DOCKER_REPOSITORY:-quay.io/unstructured-io/unstructured}"
PIP_VERSION="${PIP_VERSION:-22.2.1}"
DOCKER_IMAGE_NAME="${DOCKER_IMAGE_NAME:-unstructured:dev}"
DOCKER_BUILDKIT=1 docker buildx build --load --platform=linux/amd64 -f Dockerfile \
DOCKER_BUILD_CMD=(docker buildx build --load -f Dockerfile \
--build-arg PIP_VERSION="$PIP_VERSION" \
--build-arg BUILDKIT_INLINE_CACHE=1 \
--progress plain \
-t unstructured-dev:latest .
--cache-from "$DOCKER_REPOSITORY":latest \
-t "$DOCKER_IMAGE_NAME" .)
# only build for specific platform if DOCKER_BUILD_PLATFORM is set
if [ -n "${DOCKER_BUILD_PLATFORM:-}" ]; then
DOCKER_BUILD_CMD+=("--platform=$DOCKER_BUILD_PLATFORM")
fi
DOCKER_BUILDKIT=1 "${DOCKER_BUILD_CMD[@]}"

View File

@ -1 +1 @@
__version__ = "0.5.12-dev0" # pragma: no cover
__version__ = "0.5.12-dev1" # pragma: no cover