Dockerfile 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. FROM debian:buster
  2. MAINTAINER Abram Connelly <abram@clementinecomputing.com>
  3. RUN \
  4. apt-get update && \
  5. apt-get -y upgrade && \
  6. apt-get clean
  7. RUN \
  8. apt-get install -y gcc perl \
  9. sudo \
  10. git openssh-server sqlite3 libdbd-sqlite3-perl \
  11. default-mysql-server apache2 \
  12. netcat telnet wget python3-flask python3-pymysql python3-pip \
  13. mariadb-server
  14. RUN \
  15. apt-get install -y libswitch-perl libdate-calc-perl python3-bson python3-pymongo
  16. RUN \
  17. pip3 install flask-restful
  18. RUN \
  19. useradd -m bus && \
  20. echo 'bus:bus' | chpasswd && \
  21. echo 'root:bus' | chpasswd && \
  22. usermod -aG sudo bus
  23. RUN \
  24. su bus -c " cd /home/bus && \
  25. git clone https://tree.clementinecomputing.com/clementinecomputing/popufare && \
  26. mkdir -p /home/bus/.ssh && chmod 0700 /home/bus/.ssh && \
  27. mkdir -p /home/bus/bin && \
  28. mkdir -p /home/bus/data && \
  29. sqlite3 /home/bus/data/bus.sqlite < /home/bus/popufare/server/sql_schema/create_tables.sqlite && \
  30. sqlite3 /home/bus/data/bus.sqlite < /home/bus/popufare/server/testing/db/setup-testdb.sqlite "
  31. COPY setup-testdb /root/setup-testdb
  32. RUN bash /root/setup-testdb
  33. ## setup test ssh access
  34. ##
  35. ## WARNING: this MUST be changed for anything other than testing purposes
  36. ##
  37. COPY ./snakeoil_id_rsa.pub /home/bus/.ssh/authorized_keys.snakeoil
  38. RUN su bus -c \
  39. " cat /home/bus/.ssh/authorized_keys.snakeoil >> /home/bus/.ssh/authorized_keys && \
  40. chmod 640 /home/bus/.ssh/authorized_keys "
  41. # non-essential but helpful for debuggin/admin
  42. #
  43. RUN \
  44. apt-get install -y vim
  45. RUN \
  46. mkdir -p /etc/ridelogic && \
  47. mkdir -p /etc/ridelogic/logs && \
  48. mkdir -p /var/log/ridelogic && \
  49. mkdir -p /var/run/ridelogic && \
  50. cp -f /home/bus/popufare/server/install/etc/ridelogic/api.conf /etc/ridelogic && \
  51. cp -f /home/bus/popufare/server/install/etc/ridelogic/daemon.conf /etc/ridelogic && \
  52. cp -f /home/bus/popufare/server/scripts/RideLogic.pm /usr/share/perl5 && \
  53. cp -f /home/bus/popufare/server/scripts/RideLogicDBI.pm /usr/share/perl5 && \
  54. cp -f /home/bus/popufare/server/scripts/RideLogicACL.pm /usr/share/perl5 && \
  55. cp -f /home/bus/popufare/server/scripts/RideLogicAPIQueryWrapper.pm /usr/share/perl5 && \
  56. cp -f /home/bus/popufare/server/config/etc/mysql/mariadb.conf.d/50-server.cnf /etc/mysql/mariadb.conf.d/50-server.cnf
  57. # main startup scripts
  58. #
  59. COPY ./startup_and_persist.sh /root/startup_and_persist.sh
  60. RUN \
  61. chmod u+x /root/startup_and_persist.sh
  62. EXPOSE 80 22 443 6055 2857 7277 2455 3556 8377 5000
  63. CMD ["/root/startup_and_persist.sh"]