sebw / pushtify

Listen for Gotify notifications over websocket and forward them to Pushover
30 stars 6 forks source link

Docker image build errors #1

Open jarandaf opened 5 months ago

jarandaf commented 5 months ago

I can't seem to build this docker image, mostly due to this ntfy dependency ruamel.yaml.clib>=0.2.7. I get the following error:

3.954 Collecting ruamel.yaml.clib>=0.2.7
3.970   Downloading ruamel.yaml.clib-0.2.8.tar.gz (213 kB)
4.064   Installing build dependencies: started
7.163   Installing build dependencies: finished with status 'done'
7.172   Getting requirements to build wheel: started
7.460   Getting requirements to build wheel: finished with status 'done'
7.463     Preparing wheel metadata: started
7.758     Preparing wheel metadata: finished with status 'done'
7.765 Building wheels for collected packages: ruamel.yaml.clib
7.768   Building wheel for ruamel.yaml.clib (PEP 517): started
8.090   Building wheel for ruamel.yaml.clib (PEP 517): finished with status 'error'
8.091   ERROR: Command errored out with exit status 1:
8.091    command: /usr/bin/python3 /usr/lib/python3.9/site-packages/pip/_vendor/pep517/_in_process.py build_wheel /tmp/tmp44lwpm7o
8.091        cwd: /tmp/pip-install-bmn24p49/ruamel-yaml-clib_b2798efff4964b30a779b2d269943c59
8.091   Complete output (16 lines):
8.091   running bdist_wheel
8.091   running build
8.091   running build_py
8.091   creating build
8.091   creating build/lib.linux-x86_64-cpython-39
8.091   creating build/lib.linux-x86_64-cpython-39/ruamel
8.091   creating build/lib.linux-x86_64-cpython-39/ruamel/yaml
8.091   creating build/lib.linux-x86_64-cpython-39/ruamel/yaml/clib
8.091   copying ./setup.py -> build/lib.linux-x86_64-cpython-39/ruamel/yaml/clib
8.091   copying ./__init__.py -> build/lib.linux-x86_64-cpython-39/ruamel/yaml/clib
8.091   copying ./LICENSE -> build/lib.linux-x86_64-cpython-39/ruamel/yaml/clib
8.091   running build_ext
8.091   building '_ruamel_yaml' extension
8.091   creating build/temp.linux-x86_64-cpython-39
8.091   gcc -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fomit-frame-pointer -g -fno-semantic-interposition -fomit-frame-pointer -g -fno-semantic-interposition -fomit-frame-pointer -g -fno-semantic-interposition -DTHREAD_STACK_SIZE=0x100000 -fPIC -I/usr/include/python3.9 -c _ruamel_yaml.c -o build/temp.linux-x86_64-cpython-39/_ruamel_yaml.o
8.091   error: command 'gcc' failed: No such file or directory
8.091   ----------------------------------------
8.091   ERROR: Failed building wheel for ruamel.yaml.clib
8.092 Failed to build ruamel.yaml.clib
8.092 ERROR: Could not build wheels for ruamel.yaml.clib which use PEP 517 and cannot be installed directly
------
Dockerfile:2
--------------------
   1 |     FROM alpine:3.15
   2 | >>> RUN apk add --no-cache py3-pip && pip3 install ntfy && pip3 install websocket-client && rm -fr /var/cache/*
   3 |     ARG GOTIFY_TOKEN=xyz
   4 |     ARG GOTIFY_HOST=gotify.example.org
--------------------
emcgarcia101 commented 4 months ago

Hey man, i fixed the docker file:

FROM alpine:3.19 RUN apk update RUN apk add --no-cache alpine-sdk RUN apk add --no-cache py3-pip RUN python3 -m venv /opt/venv ENV PATH="/opt/venv/bin:$PATH" RUN pip3 install ntfy RUN pip3 install websocket-client RUN sed -i '6s+getargspec+getfullargspec+1' /opt/venv/lib/python3.11/site-packages/ntfy/__init__.py RUN rm -fr /var/cache/* ENV GOTIFY_TOKEN=xyz ENV GOTIFY_HOST=gotify.example.org ENV PUSHOVER_USERKEY=abcdefghijklmnopqrstuvwxyz COPY pushtify-listener.py /usr/local/bin ENTRYPOINT ["python3","/usr/local/bin/pushtify-listener.py"]

And to run just fix the envs below:

docker run --name pushtify -e GOTIFY_TOKEN=zzz -e GOTIFY_HOST=gotify.example.org -e PUSHOVER_USERKEY=xxx ghcr.io/sebw/pushtify:v0.5

emcgarcia101 commented 4 months ago

Use this one to run on background and start on boot

docker run -d --restart unless-stopped --name pushtify -e GOTIFY_TOKEN=zzz -e GOTIFY_HOST=gotify.example.org -e PUSHOVER_USERKEY=xxx ghcr.io/sebw/pushtify:v0.5

sebw commented 4 weeks ago

Are you still having issues rebuilding?

ristomatti commented 1 week ago

That did not work for me at least. I believe the problem is that Python package ntfy doesn't support Python 3.11 or newer. It seems to build and run with this modified Dockerfile:

FROM python:3.10.7-alpine3.16

RUN pip install ntfy && \
    pip install websocket-client && \
    rm -rf /var/cache/*

ENV GOTIFY_TOKEN=xyz
ENV GOTIFY_HOST=gotify.example.org
ENV PUSHOVER_USERKEY=abcdefghijklmnopqrstuvwxyz

COPY pushtify-listener.py /usr/local/bin

ENTRYPOINT ["python3","/usr/local/bin/pushtify-listener.py"]