Dockerfile 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  1. #
  2. # Licensed to the Apache Software Foundation (ASF) under one or more
  3. # contributor license agreements. See the NOTICE file distributed with
  4. # this work for additional information regarding copyright ownership.
  5. # The ASF licenses this file to You under the Apache License, Version 2.0
  6. # (the "License"); you may not use this file except in compliance with
  7. # the License. You may obtain a copy of the License at
  8. #
  9. # http://www.apache.org/licenses/LICENSE-2.0
  10. #
  11. # Unless required by applicable law or agreed to in writing, software
  12. # distributed under the License is distributed on an "AS IS" BASIS,
  13. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  14. # See the License for the specific language governing permissions and
  15. # limitations under the License.
  16. #
  17. FROM ubuntu:18.04
  18. ENV LANG=C.UTF-8
  19. ENV DEBIAN_FRONTEND=noninteractive
  20. ARG version
  21. ARG tar_version
  22. #1,install jdk
  23. RUN apt-get update \
  24. && apt-get -y install openjdk-8-jdk \
  25. && rm -rf /var/lib/apt/lists/*
  26. ENV JAVA_HOME /usr/lib/jvm/java-8-openjdk-amd64
  27. ENV PATH $JAVA_HOME/bin:$PATH
  28. #install wget
  29. RUN apt-get update && \
  30. apt-get -y install wget
  31. #2,install ZK
  32. RUN cd /opt && \
  33. wget https://www-us.apache.org/dist/zookeeper/zookeeper-3.4.14/zookeeper-3.4.14.tar.gz && \
  34. tar -zxvf zookeeper-3.4.14.tar.gz && \
  35. mv zookeeper-3.4.14 zookeeper && \
  36. rm -rf ./zookeeper-*tar.gz && \
  37. mkdir -p /tmp/zookeeper && \
  38. rm -rf /opt/zookeeper/conf/zoo_sample.cfg
  39. ADD ./dockerfile/conf/zookeeper/zoo.cfg /opt/zookeeper/conf
  40. ENV ZK_HOME=/opt/zookeeper
  41. ENV PATH $PATH:$ZK_HOME/bin
  42. #3,install maven
  43. RUN cd /opt && \
  44. wget http://apache-mirror.rbc.ru/pub/apache/maven/maven-3/3.3.9/binaries/apache-maven-3.3.9-bin.tar.gz && \
  45. tar -zxvf apache-maven-3.3.9-bin.tar.gz && \
  46. mv apache-maven-3.3.9 maven && \
  47. rm -rf ./apache-maven-*tar.gz && \
  48. rm -rf /opt/maven/conf/settings.xml
  49. ADD ./dockerfile/conf/maven/settings.xml /opt/maven/conf
  50. ENV MAVEN_HOME=/opt/maven
  51. ENV PATH $PATH:$MAVEN_HOME/bin
  52. #4,install node
  53. RUN cd /opt && \
  54. wget https://nodejs.org/download/release/v8.9.4/node-v8.9.4-linux-x64.tar.gz && \
  55. tar -zxvf node-v8.9.4-linux-x64.tar.gz && \
  56. mv node-v8.9.4-linux-x64 node && \
  57. rm -rf ./node-v8.9.4-*tar.gz
  58. ENV NODE_HOME=/opt/node
  59. ENV PATH $PATH:$NODE_HOME/bin
  60. #5,install postgresql
  61. RUN apt-get update && \
  62. apt-get install -y postgresql postgresql-contrib sudo && \
  63. sed -i 's/localhost/*/g' /etc/postgresql/10/main/postgresql.conf
  64. #6,install nginx
  65. RUN apt-get update && \
  66. apt-get install -y nginx && \
  67. rm -rf /var/lib/apt/lists/* && \
  68. echo "\ndaemon off;" >> /etc/nginx/nginx.conf && \
  69. chown -R www-data:www-data /var/lib/nginx
  70. #7,install sudo,python,vim,ping and ssh command
  71. RUN apt-get update && \
  72. apt-get -y install sudo && \
  73. apt-get -y install python && \
  74. apt-get -y install vim && \
  75. apt-get -y install iputils-ping && \
  76. apt-get -y install net-tools && \
  77. apt-get -y install openssh-server && \
  78. apt-get -y install python-pip && \
  79. pip install kazoo
  80. #8,add dolphinscheduler source code to /opt/dolphinscheduler_source
  81. ADD . /opt/dolphinscheduler_source
  82. #9,backend compilation
  83. RUN cd /opt/dolphinscheduler_source && \
  84. mvn clean package -Prelease -Dmaven.test.skip=true
  85. #10,frontend compilation
  86. RUN chmod -R 777 /opt/dolphinscheduler_source/dolphinscheduler-ui && \
  87. cd /opt/dolphinscheduler_source/dolphinscheduler-ui && \
  88. rm -rf /opt/dolphinscheduler_source/dolphinscheduler-ui/node_modules && \
  89. npm install node-sass --unsafe-perm && \
  90. npm install && \
  91. npm run build
  92. #11,modify dolphinscheduler configuration file
  93. #backend configuration
  94. RUN tar -zxvf /opt/dolphinscheduler_source/dolphinscheduler-dist/dolphinscheduler-backend/target/apache-dolphinscheduler-incubating-${tar_version}-dolphinscheduler-backend-bin.tar.gz -C /opt && \
  95. mv /opt/apache-dolphinscheduler-incubating-${tar_version}-dolphinscheduler-backend-bin /opt/dolphinscheduler && \
  96. rm -rf /opt/dolphinscheduler/conf
  97. ADD ./dockerfile/conf/dolphinscheduler/conf /opt/dolphinscheduler/conf
  98. #frontend nginx configuration
  99. ADD ./dockerfile/conf/nginx/dolphinscheduler.conf /etc/nginx/conf.d
  100. #12,open port
  101. EXPOSE 2181 2888 3888 3306 80 12345 8888
  102. COPY ./dockerfile/startup.sh /root/startup.sh
  103. #13,modify permissions and set soft links
  104. RUN chmod +x /root/startup.sh && \
  105. chmod +x /opt/dolphinscheduler/script/create-dolphinscheduler.sh && \
  106. chmod +x /opt/zookeeper/bin/zkServer.sh && \
  107. chmod +x /opt/dolphinscheduler/bin/dolphinscheduler-daemon.sh && \
  108. rm -rf /bin/sh && \
  109. ln -s /bin/bash /bin/sh && \
  110. mkdir -p /tmp/xls
  111. ENTRYPOINT ["/root/startup.sh"]