unfuck the requirements & dockerfile

This commit is contained in:
dave 2018-04-22 17:22:12 -07:00
parent 50357b91de
commit 29f5fa9e0f
6 changed files with 69 additions and 86 deletions

View File

@ -1,26 +1,21 @@
FROM ubuntu:bionic FROM ubuntu:bionic
RUN apt-get update && \
apt-get install -y python3-pip git && \
useradd --home-dir /srv/bot bot && \
mkdir -p /srv/bot && \
chown bot /srv/bot
COPY ./requirements.txt /requirements.txt
RUN pip3 install -r /requirements.txt
COPY ./ /tmp/pyircbot
RUN cd /tmp/pyircbot && \
python3 setup.py install
ENTRYPOINT ["/usr/local/bin/pyircbot"] ENTRYPOINT ["/usr/local/bin/pyircbot"]
WORKDIR /srv/bot/ WORKDIR /srv/bot/
CMD ["-c", "config.json"] CMD ["-c", "config.json"]
ADD requirements.txt /tmp/requirements.txt
RUN apt-get update && \
apt-get install -y python3 python3-setuptools python3-pip sqlite3 git && \
pip3 install -r /tmp/requirements.txt && \
useradd --home-dir /srv/bot bot && \
chown bot /srv/bot && \
apt-get remove -y python3-pip perl && \
apt-get autoremove -y && \
apt-get clean -y && \
rm -rf /var/lib/apt/lists/*
COPY . /tmp/pyircbot/
RUN cd /tmp/pyircbot/ && \
python3 setup.py install && \
su -c "cp -r /tmp/pyircbot/examples/config.json /tmp/pyircbot/examples/data/ /srv/bot/" bot && \
cd / && \
rm -rf /tmp/pyircbot
USER bot USER bot

6
bin/pyircbot → pyircbot/cli.py Executable file → Normal file
View File

@ -8,7 +8,7 @@ from pyircbot import PyIRCBot
from json import loads from json import loads
if __name__ == "__main__": def main():
" logging level and facility " " logging level and facility "
logging.basicConfig(level=logging.INFO, logging.basicConfig(level=logging.INFO,
format="%(asctime)-15s %(levelname)-8s %(filename)s:%(lineno)d %(message)s") format="%(asctime)-15s %(levelname)-8s %(filename)s:%(lineno)d %(message)s")
@ -45,3 +45,7 @@ if __name__ == "__main__":
signal.signal(signal.SIGTERM, signal_handler) signal.signal(signal.SIGTERM, signal_handler)
bot.run() bot.run()
if __name__ == "__main__":
main()

5
bin/pubsubbot → pyircbot/clipub.py Executable file → Normal file
View File

@ -112,7 +112,7 @@ class PyIRCBotSub(PrimitiveBot):
return self.meta.get("nick", None) return self.meta.get("nick", None)
if __name__ == "__main__": def main():
logging.basicConfig(level=logging.WARNING, logging.basicConfig(level=logging.WARNING,
format="%(asctime)-15s %(levelname)-8s %(filename)s:%(lineno)d %(message)s") format="%(asctime)-15s %(levelname)-8s %(filename)s:%(lineno)d %(message)s")
log = logging.getLogger('main') log = logging.getLogger('main')
@ -160,3 +160,6 @@ if __name__ == "__main__":
bot.run() bot.run()
if __name__ == "__main__":
main()

View File

@ -1,47 +1,35 @@
apipkg==1.4 apipkg==1.4
appdirs==1.4.3 attrs==17.4.0
certifi==2017.4.17 backports.functools-lru-cache==1.5
certifi==2018.4.16
chardet==3.0.4 chardet==3.0.4
cheroot==5.9.1 cheroot==6.2.4
CherryPy==12.0.1 CherryPy==14.2.0
coverage==4.4.2 coverage==4.5.1
decorator==4.0.11
execnet==1.5.0 execnet==1.5.0
idna==2.5 idna==2.6
ipdb==0.10.3 more-itertools==4.1.0
ipython==6.0.0 -e git+http://git.davepedu.com/dave/pymsgbus.git@373a9c5f153078fce57bde43f493785859f51de4#egg=msgbus
ipython-genutils==0.2.0 pluggy==0.6.0
jaraco.classes==1.4.3
jedi==0.10.2
lxml==4.1.1
mock==2.0.0
-e git+http://gitlab.davepedu.com/dave/pymsgbus.git#egg=msgbus
packaging==16.8
pbr==3.1.1
pexpect==4.2.1
pickleshare==0.7.4
portend==2.2 portend==2.2
praw==5.0.1 praw==5.4.0
prawcore==0.11.0 prawcore==0.14.0
prompt-toolkit==1.0.14 py==1.5.3
ptyprocess==0.5.1 PyJWT==1.6.1
py==1.5.2 PyMySQL==0.8.0
Pygments==2.2.0 PySocks==1.6.8
PyJWT==1.5.3 pytest==3.5.0
pyparsing==2.2.0
PySocks==1.6.7
pytest==3.2.5
pytest-cov==2.5.1 pytest-cov==2.5.1
pytest-cover==3.0.0
pytest-coverage==0.0
pytest-forked==0.2 pytest-forked==0.2
pytest-xdist==1.20.1 pytest-xdist==1.22.2
pytz==2017.3 -e git+https://github.com/jgarzik/python-bitcoinrpc.git@76ced424dc16f997365265487487056e653238c6#egg=python_bitcoinrpc
pyzmq==16.0.2 pytz==2018.4
requests==2.18.1 pyzmq==17.0.0
simplegeneric==0.8.1 requests==2.18.4
six==1.11.0 six==1.11.0
tempora==1.9 tempora==1.11
traitlets==4.3.2 twilio==6.12.1
twilio==6.9.0
update-checker==0.16 update-checker==0.16
urllib3==1.21.1 urllib3==1.22
wcwidth==0.1.7

View File

@ -1,35 +1,23 @@
alabaster==0.7.10 backports.functools-lru-cache==1.5
Babel==2.5.3 certifi==2018.4.16
certifi==2017.11.5
chardet==3.0.4 chardet==3.0.4
cheroot==6.0.0 cheroot==6.2.4
CherryPy==13.1.0 CherryPy==14.2.0
docutils==0.14
idna==2.6 idna==2.6
imagesize==0.7.1 more-itertools==4.1.0
Jinja2==2.10
lxml==4.1.1
MarkupSafe==1.0
more-itertools==4.0.1
pyzmq==16.0.3
-e git+http://git.davepedu.com/dave/pymsgbus.git@373a9c5f153078fce57bde43f493785859f51de4#egg=msgbus -e git+http://git.davepedu.com/dave/pymsgbus.git@373a9c5f153078fce57bde43f493785859f51de4#egg=msgbus
portend==2.2 portend==2.2
praw==5.3.0 praw==5.4.0
prawcore==0.13.0 prawcore==0.14.0
Pygments==2.2.0 PyJWT==1.6.1
PyJWT==1.5.3
PyMySQL==0.8.0 PyMySQL==0.8.0
PySocks==1.6.8 PySocks==1.6.8
-e git+https://github.com/jgarzik/python-bitcoinrpc.git@76ced424dc16f997365265487487056e653238c6#egg=python_bitcoinrpc -e git+https://github.com/jgarzik/python-bitcoinrpc.git@76ced424dc16f997365265487487056e653238c6#egg=python_bitcoinrpc
pytz==2017.3 pytz==2018.4
releases==1.4.0 pyzmq==17.0.0
requests==2.18.4 requests==2.18.4
semantic-version==2.6.0
six==1.11.0 six==1.11.0
snowballstemmer==1.2.1 tempora==1.11
Sphinx==1.6.6 twilio==6.12.1
sphinxcontrib-websupport==1.0.1
tempora==1.10
twilio==6.9.0
update-checker==0.16 update-checker==0.16
urllib3==1.22 urllib3==1.22

View File

@ -10,5 +10,10 @@ setup(name='pyircbot',
author='dpedu', author='dpedu',
author_email='dave@davepedu.com', author_email='dave@davepedu.com',
packages=['pyircbot', 'pyircbot.modules'], packages=['pyircbot', 'pyircbot.modules'],
scripts=['bin/pyircbot'], entry_points={
"console_scripts": [
"pyircbot = pyircbot.cli:main",
"pubsubbot = pyircbot.clipub:main"
]
},
zip_safe=False) zip_safe=False)