From 18164ef78ab08955511fc6550731593daa7a9453 Mon Sep 17 00:00:00 2001 From: Alex Kotov Date: Thu, 4 Jan 2024 20:40:33 +0400 Subject: [PATCH] Remove Docker --- .dockerignore | 1 - .github/workflows/docker.yml | 85 -------------------------------- .gitignore | 2 - README.md | 4 +- archivebox/.flake8 | 2 +- bin/build.sh | 1 - bin/build_dev.sh | 3 +- bin/build_docker.sh | 94 ------------------------------------ bin/release.sh | 2 - bin/release_docker.sh | 45 ----------------- 10 files changed, 3 insertions(+), 236 deletions(-) delete mode 100644 .github/workflows/docker.yml delete mode 100755 bin/build_docker.sh delete mode 100755 bin/release_docker.sh diff --git a/.dockerignore b/.dockerignore index 2cd1cfe0..43fbb914 100644 --- a/.dockerignore +++ b/.dockerignore @@ -12,7 +12,6 @@ __pycache__/ venv/ .venv/ -.docker-venv/ node_modules/ build/ diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml deleted file mode 100644 index 9840f7ae..00000000 --- a/.github/workflows/docker.yml +++ /dev/null @@ -1,85 +0,0 @@ -name: Build Docker image - -on: - workflow_dispatch: - push: - branches: - - '**' - tags: - - 'v*' - # pull_request: - -env: - DOCKER_IMAGE: archivebox-ci - - -jobs: - buildx: - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v4 - with: - submodules: true - fetch-depth: 1 - - - name: Set up QEMU - uses: docker/setup-qemu-action@v3 - - - name: Set up Docker Buildx - id: buildx - uses: docker/setup-buildx-action@v3 - with: - version: latest - install: true - platforms: linux/amd64,linux/arm64,linux/arm/v7 - - - name: Builder instance name - run: echo ${{ steps.buildx.outputs.name }} - - - name: Available platforms - run: echo ${{ steps.buildx.outputs.platforms }} - - - name: Cache Docker layers - uses: actions/cache@v3 - with: - path: /tmp/.buildx-cache - key: ${{ runner.os }}-buildx-${{ github.sha }} - restore-keys: | - ${{ runner.os }}-buildx- - - - name: Docker Login - uses: docker/login-action@v3 - if: github.event_name != 'pull_request' - with: - username: ${{ secrets.DOCKER_USERNAME }} - password: ${{ secrets.DOCKER_PASSWORD }} - - - name: Collect Docker tags - id: docker_meta - uses: docker/metadata-action@v5 - with: - images: archivebox/archivebox,nikisweeting/archivebox - flavor: | - latest=auto - tags: | - type=ref,event=branch - type=semver,pattern={{version}} - type=semver,pattern={{major}}.{{minor}} - type=sha - - - name: Build and push - id: docker_build - uses: docker/build-push-action@v5 - with: - context: ./ - file: ./Dockerfile - builder: ${{ steps.buildx.outputs.name }} - push: ${{ github.event_name != 'pull_request' }} - tags: ${{ steps.docker_meta.outputs.tags }} - cache-from: type=local,src=/tmp/.buildx-cache - cache-to: type=local,dest=/tmp/.buildx-cache - platforms: linux/amd64,linux/arm64,linux/arm/v7 - - - name: Image digest - run: echo ${{ steps.docker_build.outputs.digest }} diff --git a/.gitignore b/.gitignore index 4f88ab61..856778d7 100644 --- a/.gitignore +++ b/.gitignore @@ -9,7 +9,6 @@ tests/out/ # Python and Node dependencies venv/ .venv/ -.docker-venv/ node_modules/ # Packaging artifacts @@ -32,4 +31,3 @@ output/ # kotovalexarian /deb_dist/ -/docker/ diff --git a/README.md b/README.md index 05a94362..4f03fdc4 100644 --- a/README.md +++ b/README.md @@ -1014,7 +1014,7 @@ Extractors take the URL of a page to archive, write their output to the filesyst -#### Build pip package and docker image +#### Build pip package
Click to expand... @@ -1024,7 +1024,6 @@ Extractors take the URL of a page to archive, write their output to the filesyst # or individually: ./bin/build_deb.sh -./bin/build_docker.sh ```
@@ -1039,7 +1038,6 @@ Extractors take the URL of a page to archive, write their output to the filesyst # or individually: ./bin/release_deb.sh -./bin/release_docker.sh ``` diff --git a/archivebox/.flake8 b/archivebox/.flake8 index 01af646d..57a24adb 100644 --- a/archivebox/.flake8 +++ b/archivebox/.flake8 @@ -3,4 +3,4 @@ ignore = D100,D101,D102,D103,D104,D105,D202,D203,D205,D400,E131,E241,E252,E266,E select = F,E9,W max-line-length = 130 max-complexity = 10 -exclude = migrations,tests,node_modules,vendor,venv,.venv,.venv2,.docker-venv +exclude = migrations,tests,node_modules,vendor,venv,.venv,.venv2 diff --git a/bin/build.sh b/bin/build.sh index 7fba4651..1e92b0b6 100755 --- a/bin/build.sh +++ b/bin/build.sh @@ -18,7 +18,6 @@ cd "$REPO_DIR" # the order matters ./bin/build_deb.sh -./bin/build_docker.sh echo "[√] Done. Install the built package by running:" echo " python3 setup.py install" diff --git a/bin/build_dev.sh b/bin/build_dev.sh index b5acda44..67412469 100755 --- a/bin/build_dev.sh +++ b/bin/build_dev.sh @@ -1,5 +1,4 @@ #!/usr/bin/env bash -# ./bin/build_docker.sh dev 'linux/arm/v7' ### Bash Environment Setup # http://redsymbol.net/articles/unofficial-bash-strict-mode/ @@ -32,4 +31,4 @@ docker build . --no-cache -t archivebox-dev --load # -t archivebox \ # -t archivebox:$TAG_NAME \ # -t archivebox:$VERSION \ -# -t archivebox:$SHORT_VERSION \ No newline at end of file +# -t archivebox:$SHORT_VERSION diff --git a/bin/build_docker.sh b/bin/build_docker.sh deleted file mode 100755 index c88ed54c..00000000 --- a/bin/build_docker.sh +++ /dev/null @@ -1,94 +0,0 @@ -#!/usr/bin/env bash -# ./bin/build_docker.sh dev 'linux/arm/v7' - -### Bash Environment Setup -# http://redsymbol.net/articles/unofficial-bash-strict-mode/ -# https://www.gnu.org/software/bash/manual/html_node/The-Set-Builtin.html -# set -o xtrace -set -o errexit -set -o errtrace -set -o nounset -set -o pipefail -IFS=$'\n' - -REPO_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && cd .. && pwd )" -cd "$REPO_DIR" - -which docker > /dev/null || exit 1 -which jq > /dev/null || exit 1 -# which pdm > /dev/null || exit 1 - -SUPPORTED_PLATFORMS="linux/amd64,linux/arm64,linux/arm/v7" - -TAG_NAME="${1:-$(git rev-parse --abbrev-ref HEAD)}" -VERSION="$(jq -r '.version' < "$REPO_DIR/package.json")" -SHORT_VERSION="$(echo "$VERSION" | perl -pe 's/(\d+)\.(\d+)\.(\d+)/$1.$2/g')" -SELECTED_PLATFORMS="${2:-$SUPPORTED_PLATFORMS}" - -echo "[+] Building Docker image: tag=$TAG_NAME version=$SHORT_VERSION arch=$SELECTED_PLATFORMS" - -function check_platforms() { - INSTALLED_PLATFORMS="$(docker buildx inspect | grep 'Platforms:' )" - - for REQUIRED_PLATFORM in ${SELECTED_PLATFORMS//,/$IFS}; do - echo "[+] Checking for: $REQUIRED_PLATFORM..." - if ! (echo "$INSTALLED_PLATFORMS" | grep -q "$REQUIRED_PLATFORM"); then - return 1 - fi - done - echo - return 0 -} - -function remove_builder() { - # remove existing xbuilder - docker buildx stop xbuilder || true - docker buildx rm xbuilder || true -} - -function create_builder() { - docker buildx use xbuilder && return 0 - echo "[+] Creating new xbuilder for: $SELECTED_PLATFORMS" - echo - - # Switch to buildx builder if already present / previously created - docker buildx create --name xbuilder --driver docker-container --bootstrap --use --platform "$SELECTED_PLATFORMS" || true - docker buildx inspect --bootstrap || true -} - -function recreate_builder() { - # Install QEMU binaries for cross-platform building if not installed - docker run --privileged --rm 'tonistiigi/binfmt' --install all - - remove_builder - create_builder -} - -# Check if docker is ready for cross-plaform builds, if not, recreate builder -docker buildx use xbuilder 2>&1 >/dev/null || create_builder -check_platforms || (recreate_builder && check_platforms) || exit 1 - - -# Build python package lists -echo "[+] Generating requirements.txt and pdm.lock from pyproject.toml..." -pdm lock --group=':all' --strategy="cross_platform" --production -pdm export --group=':all' --production --without-hashes -o requirements.txt - -echo "[+] Building archivebox:$VERSION docker image..." -# docker builder prune -# 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:$VERSION \ - -t archivebox/archivebox:$SHORT_VERSION \ - -t archivebox/archivebox:latest \ - -t nikisweeting/archivebox \ - -t nikisweeting/archivebox:$TAG_NAME \ - -t nikisweeting/archivebox:$VERSION \ - -t nikisweeting/archivebox:$SHORT_VERSION \ - -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 diff --git a/bin/release.sh b/bin/release.sh index 7798a112..922f70c8 100755 --- a/bin/release.sh +++ b/bin/release.sh @@ -21,12 +21,10 @@ cd "$REPO_DIR" # Run all the build scripts ./bin/build_git.sh ./bin/build_deb.sh -./bin/build_docker.sh # Push relase to public repositories ./bin/release_git.sh ./bin/release_deb.sh -./bin/release_docker.sh VERSION="$(jq -r '.version' < "$REPO_DIR/package.json")" echo "[√] Done. Published version v$VERSION" diff --git a/bin/release_docker.sh b/bin/release_docker.sh deleted file mode 100755 index 15e1b666..00000000 --- a/bin/release_docker.sh +++ /dev/null @@ -1,45 +0,0 @@ -#!/usr/bin/env bash - -### Bash Environment Setup -# http://redsymbol.net/articles/unofficial-bash-strict-mode/ -# https://www.gnu.org/software/bash/manual/html_node/The-Set-Builtin.html -# set -o xtrace -set -o errexit -set -o errtrace -set -o nounset -set -o pipefail -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" - -TAG_NAME="${1:-$(git rev-parse --abbrev-ref HEAD)}" -VERSION="$(jq -r '.version' < "$REPO_DIR/package.json")" -SHORT_VERSION="$(echo "$VERSION" | perl -pe 's/(\d+)\.(\d+)\.(\d+)/$1.$2/g')" -SELECTED_PLATFORMS="${2:-$SUPPORTED_PLATFORMS}" - - -# echo "[*] Logging in to Docker Hub & Github Container Registry" -# docker login --username=nikisweeting -# docker login ghcr.io --username=pirate - -echo "[^] Building docker image" -./bin/build_docker.sh "$TAG_NAME" "$SELECTED_PLATFORMS" - -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:latest \ - -t nikisweeting/archivebox \ - -t nikisweeting/archivebox:$TAG_NAME \ - -t nikisweeting/archivebox:$VERSION \ - -t nikisweeting/archivebox:$SHORT_VERSION \ - -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 \ No newline at end of file