diff --git a/Dockerfile b/Dockerfile index 34f9fbc..5286d26 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,28 +1,20 @@ -FROM python:3-alpine - -# install build deps for pycryptodome and other c-based python modules -RUN apk add alpine-sdk autoconf automake libtool gcc +FROM python:3.12-alpine # add env var to let the relay know it's in a container ENV DOCKER_RUNNING=true # setup various container properties VOLUME ["/data"] -CMD ["python", "-m", "relay"] +CMD ["python3", "-m", "relay"] EXPOSE 8080/tcp WORKDIR /opt/activityrelay +# only copy necessary files +COPY relay ./relay +COPY pyproject.toml ./ + # install and update important python modules RUN pip3 install -U setuptools wheel pip -# only copy necessary files -COPY relay ./relay -COPY LICENSE . -COPY README.md . -COPY requirements.txt . -COPY setup.cfg . -COPY setup.py . -COPY .git ./.git - # install relay deps -RUN pip3 install -r requirements.txt +RUN pip3 install `python3 -c "import tomllib; print(' '.join(dep.replace(' ', '') for dep in tomllib.load(open('pyproject.toml', 'rb'))['project']['dependencies']))"` diff --git a/dev-requirements.txt b/dev-requirements.txt deleted file mode 100644 index aa8a793..0000000 --- a/dev-requirements.txt +++ /dev/null @@ -1,6 +0,0 @@ -flake8 == 7.0.0 -mypy == 1.9.0 -pyinstaller == 6.3.0 -watchdog == 4.0.0 - -typing_extensions >= 4.10.0; python_version < '3.11.0' diff --git a/docker.sh b/docker.sh index d372dbf..9897a23 100755 --- a/docker.sh +++ b/docker.sh @@ -54,6 +54,7 @@ case $1 in COLS="%-22s %s\n" echo "Valid commands:" + printf "$COLS" "- start" "Run the relay in the background" printf "$COLS" "- stop" "Stop the relay" printf "$COLS" "- manage [args]" "Run a relay management command" @@ -62,5 +63,8 @@ case $1 in printf "$COLS" "- rescue" "Drop into a bash shell on a temp container with the data volume mounted" printf "$COLS" "- install" "Build the image, create a new container and volume, and run relay setup" printf "$COLS" "- uninstall" "Delete the relay image, container, and volume" + + echo "" + echo "Note: This script may not work. It is recommended to manually install and manage the container if you know what you're doing." ;; esac diff --git a/pyproject.toml b/pyproject.toml index 805e24a..c181f8e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -15,8 +15,23 @@ classifiers = [ "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", ] +dependencies = [ + "activitypub-utils == 0.2.1", + "aiohttp >= 3.9.1", + "aiohttp-swagger[performance] == 1.0.16", + "argon2-cffi == 23.1.0", + "barkshark-sql == 0.1.2", + "click >= 8.1.2", + "hiredis == 2.3.2", + "jinja2-haml == 0.3.5", + "markdown == 3.5.2", + "platformdirs == 4.2.0", + "pyyaml >= 6.0", + "redis == 5.0.1", + "importlib_resources == 6.1.1; python_version < '3.9'" +] requires-python = ">=3.8" -dynamic = ["version", "dependencies", "optional-dependencies"] +dynamic = ["version"] [project.readme] file = "README.md" @@ -30,6 +45,15 @@ Tracker = "https://git.pleroma.social/pleroma/relay/-/issues" [project.scripts] activityrelay = "relay.manage:main" +[project.optional-dependencies] +dev = [ + "flake8 == 7.0.0", + "mypy == 1.9.0", + "pyinstaller == 6.3.0", + "watchdog == 4.0.0", + "typing_extensions >= 4.10.0; python_version < '3.11.0'" +] + [tool.setuptools] zip-safe = false packages = [ @@ -50,7 +74,6 @@ relay = [ [tool.setuptools.dynamic] version = {attr = "relay.__version__"} -dependencies = {file = ["requirements.txt"]} [tool.setuptools.dynamic.optional-dependencies] dev = {file = ["dev-requirements.txt"]} diff --git a/requirements.txt b/requirements.txt deleted file mode 100644 index 90f0b07..0000000 --- a/requirements.txt +++ /dev/null @@ -1,14 +0,0 @@ -activitypub-utils == 0.2.1 -aiohttp >= 3.9.1 -aiohttp-swagger[performance] == 1.0.16 -argon2-cffi == 23.1.0 -barkshark-sql == 0.1.2 -click >= 8.1.2 -hiredis == 2.3.2 -jinja2-haml == 0.3.5 -markdown == 3.5.2 -platformdirs == 4.2.0 -pyyaml >= 6.0 -redis == 5.0.1 - -importlib_resources == 6.1.1; python_version < '3.9'