From ff7567dc1b020338dc7c327b6ab9279d5d53391c Mon Sep 17 00:00:00 2001 From: Giacomo Leidi Date: Tue, 11 Jul 2023 19:20:08 +0200 Subject: [PATCH] Update docker image. --- .github/workflows/release.yml | 2 +- guix.scm | 63 ++--------------------------------- scripts/build_docker_image.sh | 10 ++++-- 3 files changed, 10 insertions(+), 65 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index da5998d..88fd037 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -31,7 +31,7 @@ jobs: # Runs a set of commands using the runners shell - name: Build image - run: scripts/build_docker_image.sh + run: scripts/build_docker_image.sh -r - name: Upload pack (Docker) uses: actions/upload-artifact@v2 with: diff --git a/guix.scm b/guix.scm index cb89e7c..196be88 100644 --- a/guix.scm +++ b/guix.scm @@ -21,33 +21,7 @@ #:recursive? #t #:select? (git-predicate %source-dir))) -(use-modules (guix download) - (guix transformations)) -(define-public python-tweepy-4.13 - (package - (inherit python-tweepy) - (version "4.13.0") - (source (origin - (method url-fetch) - (uri (pypi-uri "tweepy" version)) - (sha256 - (base32 - "123cikpmp2m360pxh2qarb4kkjmv8wi2prx7df178rlzbwrjax09")))) - (arguments - `(#:tests? #f)))) - -(define-public python-oauthlib-3.2 - (package - (inherit python-oauthlib) - (version "3.2.2") - (source (origin - (method url-fetch) - (uri (pypi-uri "oauthlib" version)) - (sha256 - (base32 - "066r7mimlpb5q1fr2f1z59l4jc89kv4h2kgkcifyqav6544w8ncq")))))) - -(define _mobilizon-reshare.git +(define mobilizon-reshare.git (let ((source-version (with-input-from-file (string-append %source-dir "/mobilizon_reshare/VERSION") @@ -58,40 +32,7 @@ (package (inherit mobilizon-reshare) (name "mobilizon-reshare.git") (version (git-version source-version revision commit)) - (source mobilizon-reshare-git-origin) - (arguments - (substitute-keyword-arguments (package-arguments mobilizon-reshare) - ((#:phases phases) - #~(modify-phases #$phases - (add-after 'unpack 'patch-version - (lambda _ - (with-output-to-file "mobilizon_reshare/VERSION" - (lambda _ - (display #$version))))) - (delete 'patch-pyproject.toml))))) - (native-inputs - (modify-inputs (package-native-inputs mobilizon-reshare) - (prepend python-httpx))) - (propagated-inputs - (modify-inputs (package-propagated-inputs mobilizon-reshare) - (prepend python-asyncpg - python-uvicorn - python-fastapi - python-fastapi-pagination) - (replace "python-tweepy" - python-tweepy-4.13) - (replace "dynaconf" - dynaconf-3.1.11) - (replace "python-markdownify" - python-markdownify)))))) - -(define-public patch-for-mobilizon-reshare-0.3.3 - (package-input-rewriting/spec `(("python-oauthlib" . ,(const python-oauthlib-3.2)) - ("python-beautifulsoup4" . ,(const python-beautifulsoup4)) - ("python-tortoise-orm" . ,(const python-tortoise-orm))))) - -(define-public mobilizon-reshare.git - (patch-for-mobilizon-reshare-0.3.3 _mobilizon-reshare.git)) + (source mobilizon-reshare-git-origin)))) (define-public mobilizon-reshare-scheduler (package (inherit mobilizon-reshare.git) diff --git a/scripts/build_docker_image.sh b/scripts/build_docker_image.sh index 8099199..f45d260 100755 --- a/scripts/build_docker_image.sh +++ b/scripts/build_docker_image.sh @@ -1,6 +1,10 @@ #!/bin/sh -set -eu +set -e -guix time-machine -C channels-lock.scm -- build -f guix.scm +if [ "$1" = "--release" ] || [ "$1" = "-r" ]; then + with_input="--with-input=mobilizon-reshare.git=mobilizon-reshare" +fi -guix time-machine -C channels-lock.scm -- pack -L . -f docker -S /opt/bin=bin --save-provenance --root=docker-image.tar.gz --entry-point=bin/scheduler.py mobilizon-reshare-scheduler python +guix time-machine -C channels-lock.scm -- build -L . ${with_input} mobilizon-reshare-scheduler + +guix time-machine -C channels-lock.scm -- pack -L . ${with_input} -f docker -S /opt/bin=bin --save-provenance --root=docker-image.tar.gz --entry-point=bin/scheduler.py mobilizon-reshare-scheduler python