Dockerfile 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  1. FROM ubuntu:18.04
  2. ENV LANG=C.UTF-8
  3. ARG version
  4. ARG tar_version
  5. #1,install jdk
  6. RUN apt-get update \
  7. && apt-get -y install openjdk-8-jdk \
  8. && rm -rf /var/lib/apt/lists/*
  9. ENV JAVA_HOME /usr/lib/jvm/java-8-openjdk-amd64
  10. ENV PATH $JAVA_HOME/bin:$PATH
  11. #install wget
  12. RUN apt-get update && \
  13. apt-get -y install wget
  14. #2,install ZK
  15. RUN cd /opt && \
  16. wget https://www-us.apache.org/dist/zookeeper/zookeeper-3.4.14/zookeeper-3.4.14.tar.gz && \
  17. tar -zxvf zookeeper-3.4.14.tar.gz && \
  18. mv zookeeper-3.4.14 zookeeper && \
  19. rm -rf ./zookeeper-*tar.gz && \
  20. mkdir -p /tmp/zookeeper && \
  21. rm -rf /opt/zookeeper/conf/zoo_sample.cfg
  22. ADD ./dockerfile/conf/zookeeper/zoo.cfg /opt/zookeeper/conf
  23. ENV ZK_HOME=/opt/zookeeper
  24. ENV PATH $PATH:$ZK_HOME/bin
  25. #3,install maven
  26. RUN cd /opt && \
  27. wget http://apache-mirror.rbc.ru/pub/apache/maven/maven-3/3.3.9/binaries/apache-maven-3.3.9-bin.tar.gz && \
  28. tar -zxvf apache-maven-3.3.9-bin.tar.gz && \
  29. mv apache-maven-3.3.9 maven && \
  30. rm -rf ./apache-maven-*tar.gz && \
  31. rm -rf /opt/maven/conf/settings.xml
  32. ADD ./dockerfile/conf/maven/settings.xml /opt/maven/conf
  33. ENV MAVEN_HOME=/opt/maven
  34. ENV PATH $PATH:$MAVEN_HOME/bin
  35. #4,install node
  36. RUN cd /opt && \
  37. wget https://nodejs.org/download/release/v8.9.4/node-v8.9.4-linux-x64.tar.gz && \
  38. tar -zxvf node-v8.9.4-linux-x64.tar.gz && \
  39. mv node-v8.9.4-linux-x64 node && \
  40. rm -rf ./node-v8.9.4-*tar.gz
  41. ENV NODE_HOME=/opt/node
  42. ENV PATH $PATH:$NODE_HOME/bin
  43. #5,add dolphinscheduler source code to /opt/dolphinscheduler_source
  44. ADD . /opt/dolphinscheduler_source
  45. #5,backend compilation
  46. RUN cd /opt/dolphinscheduler_source && \
  47. mvn -U clean package assembly:assembly -Dmaven.test.skip=true
  48. #6,frontend compilation
  49. RUN chmod -R 777 /opt/dolphinscheduler_source/dolphinscheduler-ui && \
  50. cd /opt/dolphinscheduler_source/dolphinscheduler-ui && \
  51. rm -rf /opt/dolphinscheduler_source/dolphinscheduler-ui/node_modules && \
  52. npm install node-sass --unsafe-perm && \
  53. npm install && \
  54. npm run build
  55. #7,install mysql
  56. RUN echo "deb http://cn.archive.ubuntu.com/ubuntu/ xenial main restricted universe multiverse" >> /etc/apt/sources.list
  57. RUN echo "mysql-server mysql-server/root_password password root" | debconf-set-selections
  58. RUN echo "mysql-server mysql-server/root_password_again password root" | debconf-set-selections
  59. RUN apt-get update && \
  60. apt-get -y install mysql-server-5.7 && \
  61. mkdir -p /var/lib/mysql && \
  62. mkdir -p /var/run/mysqld && \
  63. mkdir -p /var/log/mysql && \
  64. chown -R mysql:mysql /var/lib/mysql && \
  65. chown -R mysql:mysql /var/run/mysqld && \
  66. chown -R mysql:mysql /var/log/mysql
  67. # UTF-8 and bind-address
  68. RUN sed -i -e "$ a [client]\n\n[mysql]\n\n[mysqld]" /etc/mysql/my.cnf && \
  69. sed -i -e "s/\(\[client\]\)/\1\ndefault-character-set = utf8/g" /etc/mysql/my.cnf && \
  70. sed -i -e "s/\(\[mysql\]\)/\1\ndefault-character-set = utf8/g" /etc/mysql/my.cnf && \
  71. sed -i -e "s/\(\[mysqld\]\)/\1\ninit_connect='SET NAMES utf8'\ncharacter-set-server = utf8\ncollation-server=utf8_general_ci\nbind-address = 0.0.0.0/g" /etc/mysql/my.cnf
  72. #8,install nginx
  73. RUN apt-get update && \
  74. apt-get install -y nginx && \
  75. rm -rf /var/lib/apt/lists/* && \
  76. echo "\ndaemon off;" >> /etc/nginx/nginx.conf && \
  77. chown -R www-data:www-data /var/lib/nginx
  78. #9,modify dolphinscheduler configuration file
  79. #backend configuration
  80. RUN mkdir -p /opt/dolphinscheduler && \
  81. tar -zxvf /opt/dolphinscheduler_source/target/dolphinscheduler-${tar_version}.tar.gz -C /opt/dolphinscheduler && \
  82. rm -rf /opt/dolphinscheduler/conf
  83. ADD ./dockerfile/conf/dolphinscheduler/conf /opt/dolphinscheduler/conf
  84. #frontend nginx configuration
  85. ADD ./dockerfile/conf/nginx/dolphinscheduler.conf /etc/nginx/conf.d
  86. #10,open port
  87. EXPOSE 2181 2888 3888 3306 80 12345 8888
  88. #11,install sudo,python,vim,ping and ssh command
  89. RUN apt-get update && \
  90. apt-get -y install sudo && \
  91. apt-get -y install python && \
  92. apt-get -y install vim && \
  93. apt-get -y install iputils-ping && \
  94. apt-get -y install net-tools && \
  95. apt-get -y install openssh-server && \
  96. apt-get -y install python-pip && \
  97. pip install kazoo
  98. COPY ./dockerfile/startup.sh /root/startup.sh
  99. #12,modify permissions and set soft links
  100. RUN chmod +x /root/startup.sh && \
  101. chmod +x /opt/dolphinscheduler/script/create-dolphinscheduler.sh && \
  102. chmod +x /opt/zookeeper/bin/zkServer.sh && \
  103. chmod +x /opt/dolphinscheduler/bin/dolphinscheduler-daemon.sh && \
  104. rm -rf /bin/sh && \
  105. ln -s /bin/bash /bin/sh && \
  106. mkdir -p /tmp/xls
  107. ENTRYPOINT ["/root/startup.sh"]