From c570674798094e852176612f191d91c8cce1d075 Mon Sep 17 00:00:00 2001 From: Nick Sweeting Date: Mon, 3 Jun 2024 01:13:17 -0700 Subject: [PATCH] fix docker build --- Dockerfile | 8 ++++---- bin/build_docker.sh | 14 +++++++------- bin/release_docker.sh | 22 +++++++++++----------- pyproject.toml | 2 +- requirements.txt | 4 ++++ 5 files changed, 27 insertions(+), 23 deletions(-) diff --git a/Dockerfile b/Dockerfile index 8a537a88..12cc1381 100644 --- a/Dockerfile +++ b/Dockerfile @@ -253,7 +253,7 @@ RUN --mount=type=cache,target=/var/cache/apt,sharing=locked,id=apt-$TARGETARCH$T echo "[+] Installing PIP ArchiveBox dependencies from requirements.txt for ${TARGETPLATFORM}..." \ && apt-get update -qq \ && apt-get install -qq -y -t bookworm-backports \ - # build-essential \ + build-essential \ libssl-dev libldap2-dev libsasl2-dev \ python3-ldap python3-msgpack python3-mutagen python3-regex python3-pycryptodome procps \ # && ln -s "$GLOBAL_VENV" "$APP_VENV" \ @@ -263,8 +263,8 @@ RUN --mount=type=cache,target=/var/cache/apt,sharing=locked,id=apt-$TARGETARCH$T # && pdm export -o requirements.txt --without-hashes \ # && source $GLOBAL_VENV/bin/activate \ && pip install -r requirements.txt \ - # && apt-get purge -y \ - # build-essential \ + && apt-get purge -y \ + build-essential \ && apt-get autoremove -y \ && rm -rf /var/lib/apt/lists/* @@ -275,7 +275,7 @@ RUN --mount=type=cache,target=/var/cache/apt,sharing=locked,id=apt-$TARGETARCH$T # && apt-get update -qq \ # install C compiler to build deps on platforms that dont have 32-bit wheels available on pypi # && apt-get install -qq -y -t bookworm-backports \ - # build-essential \ + # build-essential \ # INSTALL ARCHIVEBOX python package globally from CODE_DIR, with all optional dependencies && pip install -e "$CODE_DIR"[sonic,ldap] \ # save docker image size and always remove compilers / build tools after building is complete diff --git a/bin/build_docker.sh b/bin/build_docker.sh index 2e611447..ac8cca65 100755 --- a/bin/build_docker.sh +++ b/bin/build_docker.sh @@ -67,7 +67,7 @@ function recreate_builder() { } # Check if docker is ready for cross-plaform builds, if not, recreate builder -docker buildx use xbuilder 2>&1 >/dev/null || create_builder +docker buildx use xbuilder >/dev/null 2>&1 || create_builder check_platforms || (recreate_builder && check_platforms) || exit 1 @@ -80,20 +80,20 @@ echo "[+] Building archivebox:$VERSION docker image..." # docker build . --no-cache -t archivebox-dev \ # replace --load with --push to deploy docker buildx build --platform "$SELECTED_PLATFORMS" --load . \ - # -t archivebox/archivebox \ -t archivebox/archivebox:$TAG_NAME \ + -t archivebox/archivebox:$GIT_SHA \ + -t nikisweeting/archivebox:$TAG_NAME \ + -t nikisweeting/archivebox:$GIT_SHA \ + -t ghcr.io/archivebox/archivebox/archivebox:$TAG_NAME \ + -t ghcr.io/archivebox/archivebox/archivebox:$GIT_SHA + # -t archivebox/archivebox \ # -t archivebox/archivebox:$VERSION \ # -t archivebox/archivebox:$SHORT_VERSION \ - -t archivebox/archivebox:$GIT_SHA \ # -t archivebox/archivebox:latest \ # -t nikisweeting/archivebox \ - -t nikisweeting/archivebox:$TAG_NAME \ # -t nikisweeting/archivebox:$VERSION \ # -t nikisweeting/archivebox:$SHORT_VERSION \ - -t nikisweeting/archivebox:$GIT_SHA \ # -t nikisweeting/archivebox:latest \ - -t ghcr.io/archivebox/archivebox/archivebox:$TAG_NAME \ # -t ghcr.io/archivebox/archivebox/archivebox:$VERSION \ # -t ghcr.io/archivebox/archivebox/archivebox:$SHORT_VERSION \ - -t ghcr.io/archivebox/archivebox/archivebox:$GIT_SHA \ # -t ghcr.io/archivebox/archivebox/archivebox:latest diff --git a/bin/release_docker.sh b/bin/release_docker.sh index 137c1b53..f3095c44 100755 --- a/bin/release_docker.sh +++ b/bin/release_docker.sh @@ -13,7 +13,7 @@ IFS=$'\n' REPO_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && cd .. && pwd )" cd "$REPO_DIR" -SUPPORTED_PLATFORMS="linux/amd64,linux/arm64,linux/arm/v7" +SUPPORTED_PLATFORMS="linux/amd64,linux/arm64" # no longer supported: linux/arm/v7 TAG_NAME="${1:-$(git rev-parse --abbrev-ref HEAD)}" VERSION="$(jq -r '.version' < "$REPO_DIR/package.json")" @@ -31,20 +31,20 @@ echo "[^] Building docker image" echo "[^] Uploading docker image" docker buildx build --platform "$SELECTED_PLATFORMS" --push . \ - -t archivebox/archivebox \ -t archivebox/archivebox:$TAG_NAME \ - -t archivebox/archivebox:$VERSION \ - -t archivebox/archivebox:$SHORT_VERSION \ -t archivebox/archivebox:$GIT_SHA \ - -t archivebox/archivebox:latest \ - -t nikisweeting/archivebox \ -t nikisweeting/archivebox:$TAG_NAME \ - -t nikisweeting/archivebox:$VERSION \ - -t nikisweeting/archivebox:$SHORT_VERSION \ -t nikisweeting/archivebox:$GIT_SHA \ - -t nikisweeting/archivebox:latest \ -t ghcr.io/archivebox/archivebox/archivebox:$TAG_NAME \ - -t ghcr.io/archivebox/archivebox/archivebox:$VERSION \ - -t ghcr.io/archivebox/archivebox/archivebox:$SHORT_VERSION \ -t ghcr.io/archivebox/archivebox/archivebox:$GIT_SHA + # -t archivebox/archivebox \ + # -t archivebox/archivebox:$VERSION \ + # -t archivebox/archivebox:$SHORT_VERSION \ + # -t archivebox/archivebox:latest \ + # -t nikisweeting/archivebox \ + # -t nikisweeting/archivebox:$VERSION \ + # -t nikisweeting/archivebox:$SHORT_VERSION \ + # -t nikisweeting/archivebox:latest \ + # -t ghcr.io/archivebox/archivebox/archivebox:$VERSION \ + # -t ghcr.io/archivebox/archivebox/archivebox:$SHORT_VERSION \ diff --git a/pyproject.toml b/pyproject.toml index 24d03ac2..896ce426 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -42,6 +42,7 @@ dependencies = [ "django-charid-field>=0.4", "django-pydantic-field>=0.3.9", "django-jsonform>=2.22.0", + "django-stubs>=5.0.2", ] homepage = "https://github.com/ArchiveBox/ArchiveBox" @@ -125,7 +126,6 @@ test = [ lint = [ "flake8", "mypy", - "django-stubs", ] [tool.pdm.scripts] diff --git a/requirements.txt b/requirements.txt index 4e4855af..f6b110cc 100644 --- a/requirements.txt +++ b/requirements.txt @@ -25,6 +25,8 @@ django-ninja==1.1.0 django-pydantic-field==0.3.9 django-settings-holder==0.1.2 django-signal-webhooks==0.3.0 +django-stubs==5.0.2 +django-stubs-ext==5.0.2 exceptiongroup==1.2.1; python_version < "3.11" executing==2.0.1 feedparser==6.0.11 @@ -62,8 +64,10 @@ sniffio==1.3.1 sonic-client==1.0.0 sqlparse==0.5.0 stack-data==0.6.3 +tomli==2.0.1; python_version < "3.11" traitlets==5.14.3 typeid-python==0.3.0 +types-pyyaml==6.0.12.20240311 typing-extensions==4.12.1 tzdata==2024.1; sys_platform == "win32" or platform_system == "Windows" tzlocal==5.2