diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 084ba5b..4444955 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -31,7 +31,7 @@ jobs: # expanded using subsequent `include` items. matrix: os: ["ubuntu-latest"] - python-version: ["3.10"] + python-version: ["3.12"] bare: [false] defaults: diff --git a/.gitignore b/.gitignore index 610e6b7..4846909 100644 --- a/.gitignore +++ b/.gitignore @@ -68,5 +68,8 @@ target/ #PyCharm .idea +# Dockerfile +docker-compose.yml + # Apprise Gateway Variable/Test Configuration apprise_gw/var/* diff --git a/Dockerfile b/Dockerfile index 46530fa..19829f4 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM python:3.11-slim AS base +FROM python:3.12-slim AS base # set version label ARG BUILD_DATE diff --git a/Dockerfile.py310 b/Dockerfile.py312 similarity index 96% rename from Dockerfile.py310 rename to Dockerfile.py312 index 2fc7883..92b7a20 100644 --- a/Dockerfile.py310 +++ b/Dockerfile.py312 @@ -27,7 +27,7 @@ # POSSIBILITY OF SUCH DAMAGE. # Base -FROM python:3.10-buster +FROM python:3.12 RUN apt-get update && \ apt-get install -y --no-install-recommends build-essential musl-dev bash && \ rm -rf /var/lib/apt/lists/* @@ -38,7 +38,7 @@ WORKDIR /apprise-api COPY requirements.txt / COPY dev-requirements.txt / ENV PYTHONPATH /apprise-api -ENV PYTHONPYCACHEPREFIX /apprise-api/__pycache__/py310 +ENV PYTHONPYCACHEPREFIX /apprise-api/__pycache__/py312 RUN pip install --no-cache-dir -r /requirements.txt -r /dev-requirements.txt diff --git a/apprise_api/supervisord-startup b/apprise_api/supervisord-startup index 6efa90d..6d001bb 100755 --- a/apprise_api/supervisord-startup +++ b/apprise_api/supervisord-startup @@ -22,42 +22,51 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN # THE SOFTWARE. -if [ $(id -u) -ne 0 ]; then - echo "You must be root to run this script." - echo "Caution: This should only be ran in a dockerized instance!" - exit 1 -fi +if [ $(id -u) -eq 0 ]; then + # + # Root User + # + echo "Apprise API Super User Startup" -# Default values -PUID=${PUID:=1000} -PGID=${PGID:=1000} + # Default values + PUID=${PUID:=1000} + PGID=${PGID:=1000} -# lookup our identifier -GROUP=$(getent group $PGID 2>/dev/null | cut -d: -f1) -[ -z "$GROUP" ] && groupadd --force -g $PGID apprise &>/dev/null && \ - GROUP=apprise + # lookup our identifier + GROUP=$(getent group $PGID 2>/dev/null | cut -d: -f1) + [ -z "$GROUP" ] && groupadd --force -g $PGID apprise &>/dev/null && \ + GROUP=apprise -USER=$(id -un $PUID 2>/dev/null) -[ $? -ne 0 ] && useradd -M -N \ - -o -u $PUID -G $GROUP -c "Apprise API User" -d /opt/apprise apprise && \ - USER=apprise + USER=$(id -un $PUID 2>/dev/null) + [ $? -ne 0 ] && useradd -M -N \ + -o -u $PUID -G $GROUP -c "Apprise API User" -d /opt/apprise apprise && \ + USER=apprise -if [ -z "$USER" ]; then - echo "The specified User ID (PUID) of $PUID is invalid; Aborting operation." - exit 1 + if [ -z "$USER" ]; then + echo "The specified User ID (PUID) of $PUID is invalid; Aborting operation." + exit 1 -elif [ -z "$GROUP" ]; then - echo "The specified Group ID (PGID) of $PGID is invalid; Aborting operation." - exit 1 -fi + elif [ -z "$GROUP" ]; then + echo "The specified Group ID (PGID) of $PGID is invalid; Aborting operation." + exit 1 + fi -# Ensure our group has been correctly assigned -usermod -a -G $GROUP $USER &>/dev/null -chmod o+w /dev/stdout /dev/stderr + # Ensure our group has been correctly assigned + usermod -a -G $GROUP $USER &>/dev/null + chmod o+w /dev/stdout /dev/stderr + +else + # + # Non-Root User + # + echo "Apprise API Non-Super User Startup" + USER=$(id -un 2>/dev/null) + GROUP=$(id -gn 2>/dev/null) +fi [ ! -d /attach ] && mkdir -p /attach chown -R $USER:$GROUP /attach -[ ! -d /config ] && mkdir -p /config /config/store +[ ! -d /config/store ] && mkdir -p /config/store chown $USER:$GROUP /config chown -R $USER:$GROUP /config/store [ ! -d /plugin ] && mkdir -p /plugin @@ -91,5 +100,6 @@ cd /opt/apprise # Launch our SupervisorD /usr/local/bin/supervisord -c /opt/apprise/webapp/etc/supervisord.conf + # Always return our SupervisorD return code exit $? diff --git a/docker-compose.yml b/docker-compose.yml index a12fd81..19209e1 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -35,11 +35,11 @@ services: ## ## > Host service (visit http://localhost on host pc to access): ## ./manage.py runserver 0.0.0.0:8000 - test.py310: - ports: - - 8000:8000 - build: - context: . - dockerfile: Dockerfile.py310 - volumes: - - ./:/apprise-api + # test.py312: + # ports: + # - 8000:8000 + # build: + # context: . + # dockerfile: Dockerfile.py312 + # volumes: + # - ./:/apprise-api diff --git a/tox.ini b/tox.ini index a5e0566..2e7f67e 100644 --- a/tox.ini +++ b/tox.ini @@ -1,5 +1,5 @@ [tox] -envlist = py311,coverage-report +envlist = py312,coverage-report skipsdist = true [testenv] @@ -14,7 +14,7 @@ commands = coverage run --parallel -m pytest {posargs} apprise_api flake8 apprise_api --count --show-source --statistics -[testenv:py311] +[testenv:py312] deps= -r{toxinidir}/requirements.txt -r{toxinidir}/dev-requirements.txt