Skip to content

Commit

Permalink
Merge pull request #34 from becitsthere/master
Browse files Browse the repository at this point in the history
Support python venv
  • Loading branch information
garyduan authored Feb 8, 2024
2 parents 1834e1c + 866ca9d commit c8616b8
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
9 changes: 5 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@ MAINTAINER [email protected]

RUN apk add --no-cache python3 && \
if [ ! -e /usr/bin/python ]; then ln -sf python3 /usr/bin/python ; fi && \
python3 -m ensurepip && \
rm -r /usr/lib/python*/ensurepip && \
pip3 install --no-cache --upgrade pip setuptools prometheus_client requests
python3 -m venv .venv && \
source .venv/bin/activate && \
pip3 install --upgrade pip setuptools prometheus_client requests
COPY startup.sh /usr/local/bin
COPY nv_exporter.py /usr/local/bin
ENTRYPOINT ["python3", "-u", "/usr/local/bin/nv_exporter.py"]
ENTRYPOINT ["startup.sh"]
5 changes: 5 additions & 0 deletions startup.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/sh
if [ -f /.venv/bin/activate ]; then
source /.venv/bin/activate
fi
python -u /usr/local/bin/nv_exporter.py "$@"

0 comments on commit c8616b8

Please sign in to comment.