From 1beb16541fe38f628826325021c8c6ba99072305 Mon Sep 17 00:00:00 2001 From: Madison Swain-Bowden Date: Sun, 2 Apr 2023 21:20:37 -0700 Subject: [PATCH] Update java to 17, signal-cli to v0.11.7 (#91) * Update java to 17, signal-cli to v0.11.7 * Add some new just recipes, update python version in actions * Update pre-commit version * Bump isort version --- .github/workflows/pull-request.yml | 4 ++-- .pre-commit-config.yaml | 2 +- Dockerfile | 15 +++++++++------ justfile | 13 ++++++++++++- requirements.txt | 4 ++-- 5 files changed, 26 insertions(+), 12 deletions(-) diff --git a/.github/workflows/pull-request.yml b/.github/workflows/pull-request.yml index faccadf..9e9adfd 100644 --- a/.github/workflows/pull-request.yml +++ b/.github/workflows/pull-request.yml @@ -11,7 +11,7 @@ jobs: - uses: actions/checkout@v2 - uses: actions/setup-python@v1 with: - python-version: 3.8 + python-version: 3.11 - name: Install Dependencies run: pip install pre-commit - name: Run static checks @@ -26,7 +26,7 @@ jobs: - uses: actions/checkout@v2 - uses: actions/setup-python@v1 with: - python-version: 3.8 + python-version: 3.11 - name: Install Dependencies run: pip install pytest pytest-cov - name: Test with pytest diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 8e8a630..2bf60ea 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -31,7 +31,7 @@ repos: - id: python-no-log-warn - repo: https://github.com/PyCQA/isort - rev: 5.9.1 + rev: 5.12.0 hooks: - id: isort name: Run isort to sort imports diff --git a/Dockerfile b/Dockerfile index 1602f3f..3701c7c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,15 +1,18 @@ -FROM python:3.8-slim +FROM python:3.11-slim + +ENV JDK_VERSION=17 \ + SIGNAL_CLI_VERSION=0.11.7 ENV PIP_NO_CACHE_DIR=1 \ - JAVA_HOME=/usr/lib/jvm/java-11-openjdk-amd64/ \ PYTHONPATH=/app \ - SIGNAL_CLI_VERSION=0.9.1 + JAVA_HOME=/usr/lib/jvm/java-${JDK_VERSION}-openjdk-amd64/ # Install OpenJDK-8 RUN apt-get update && \ mkdir -p /usr/share/man/man1 && \ apt-get install -y \ - default-jre \ + openjdk-${JDK_VERSION}-jdk \ + openjdk-${JDK_VERSION}-jre \ wget \ ca-certificates-java \ dos2unix && \ @@ -18,8 +21,8 @@ RUN apt-get update && \ # Install signal-cli WORKDIR /tmp -RUN wget -q https://github.com/AsamK/signal-cli/releases/download/v${SIGNAL_CLI_VERSION}/signal-cli-${SIGNAL_CLI_VERSION}.tar.gz && \ - tar xf /tmp/signal-cli-${SIGNAL_CLI_VERSION}.tar.gz -C /opt && \ +RUN wget -q https://github.com/AsamK/signal-cli/releases/download/v${SIGNAL_CLI_VERSION}/signal-cli-${SIGNAL_CLI_VERSION}-Linux.tar.gz && \ + tar xf /tmp/signal-cli-${SIGNAL_CLI_VERSION}-Linux.tar.gz -C /opt && \ ln -sf /opt/signal-cli-${SIGNAL_CLI_VERSION}/bin/signal-cli /usr/local/bin/ WORKDIR /app diff --git a/justfile b/justfile index f1b9b6f..f1c433d 100644 --- a/justfile +++ b/justfile @@ -5,6 +5,9 @@ COMPOSE_FILE := "--file=docker-compose.yml" + ( ) DC := "docker-compose " + COMPOSE_FILE RUN := "run --rm cli" +# Force just to hand down positional arguments so quoted arguments with spaces are +# handled appropriately +set positional-arguments # Show all available recipes @@ -27,6 +30,14 @@ down: pull: {{ DC }} pull +# Attach logs to all (or the specified) services +logs *args: + {{ DC }} logs -f {{ args }} + +# Run a command on a provided service +run *args: + {{ DC }} {{ RUN }} "$@" + # Verify all numbers verify: {{ DC }} {{ RUN }} signal-scanner-bot-verify @@ -36,5 +47,5 @@ register: {{ DC }} {{ RUN }} ./register-number.sh # Static checks -static: +lint: pre-commit run --all-files diff --git a/requirements.txt b/requirements.txt index 4d78ce5..409b09b 100644 --- a/requirements.txt +++ b/requirements.txt @@ -3,10 +3,10 @@ aiohttp>=3.7.4 backoff>=1.11.1 Click==7.1.2 peony-twitter==2.0.2 -pre-commit==2.9.0 +pre-commit==3.2.1 python-dotenv==0.19.2 pytz>=2021.3 requests==2.26.0 tweepy==3.9.0 -ujson==3.1.0 +ujson==5.7.0 urllib3==1.26.5