Jelajahi Sumber

fix docker build

Nick Sweeting 1 tahun lalu
induk
melakukan
c570674798
5 mengubah file dengan 27 tambahan dan 23 penghapusan
  1. 4 4
      Dockerfile
  2. 7 7
      bin/build_docker.sh
  3. 11 11
      bin/release_docker.sh
  4. 1 1
      pyproject.toml
  5. 4 0
      requirements.txt

+ 4 - 4
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

+ 7 - 7
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

+ 11 - 11
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 \
 

+ 1 - 1
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]

+ 4 - 0
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