Dockerfile 3.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  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 nginx:alpine
  18. ARG VERSION
  19. ENV TZ Asia/Shanghai
  20. ENV LANG C.UTF-8
  21. ENV DEBIAN_FRONTEND noninteractive
  22. #1. install dos2unix shadow bash openrc python sudo vim wget iputils net-tools ssh pip tini kazoo.
  23. #If install slowly, you can replcae alpine's mirror with aliyun's mirror, Example:
  24. #RUN sed -i "s/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g" /etc/apk/repositories
  25. RUN apk update && \
  26. apk add dos2unix shadow bash openrc python sudo vim wget iputils net-tools openssh-server py2-pip tini && \
  27. apk add --update procps && \
  28. openrc boot && \
  29. pip install kazoo
  30. #2. install jdk
  31. RUN apk add openjdk8
  32. ENV JAVA_HOME /usr/lib/jvm/java-1.8-openjdk
  33. ENV PATH $JAVA_HOME/bin:$PATH
  34. #3. install zk
  35. RUN cd /opt && \
  36. wget https://downloads.apache.org/zookeeper/zookeeper-3.5.7/apache-zookeeper-3.5.7-bin.tar.gz && \
  37. tar -zxvf apache-zookeeper-3.5.7-bin.tar.gz && \
  38. mv apache-zookeeper-3.5.7-bin zookeeper && \
  39. mkdir -p /tmp/zookeeper && \
  40. rm -rf ./zookeeper-*tar.gz && \
  41. rm -rf /opt/zookeeper/conf/zoo_sample.cfg
  42. ADD ./conf/zookeeper/zoo.cfg /opt/zookeeper/conf
  43. ENV ZK_HOME /opt/zookeeper
  44. ENV PATH $ZK_HOME/bin:$PATH
  45. #4. install pg
  46. RUN apk add postgresql postgresql-contrib
  47. #5. add dolphinscheduler
  48. ADD ./apache-dolphinscheduler-incubating-${VERSION}-SNAPSHOT-dolphinscheduler-bin.tar.gz /opt/
  49. RUN mv /opt/apache-dolphinscheduler-incubating-${VERSION}-SNAPSHOT-dolphinscheduler-bin/ /opt/dolphinscheduler/
  50. ENV DOLPHINSCHEDULER_HOME /opt/dolphinscheduler
  51. #6. modify nginx
  52. RUN echo "daemon off;" >> /etc/nginx/nginx.conf && \
  53. rm -rf /etc/nginx/conf.d/*
  54. ADD ./conf/nginx/dolphinscheduler.conf /etc/nginx/conf.d
  55. #7. add configuration and modify permissions and set soft links
  56. ADD ./checkpoint.sh /root/checkpoint.sh
  57. ADD ./startup-init-conf.sh /root/startup-init-conf.sh
  58. ADD ./startup.sh /root/startup.sh
  59. ADD ./conf/dolphinscheduler/*.tpl /opt/dolphinscheduler/conf/
  60. ADD conf/dolphinscheduler/env/dolphinscheduler_env.sh /opt/dolphinscheduler/conf/env/
  61. RUN chmod +x /root/checkpoint.sh && \
  62. chmod +x /root/startup-init-conf.sh && \
  63. chmod +x /root/startup.sh && \
  64. chmod +x /opt/dolphinscheduler/conf/env/dolphinscheduler_env.sh && \
  65. chmod +x /opt/dolphinscheduler/script/*.sh && \
  66. chmod +x /opt/dolphinscheduler/bin/*.sh && \
  67. chmod +x /opt/zookeeper/bin/*.sh && \
  68. dos2unix /root/checkpoint.sh && \
  69. dos2unix /root/startup-init-conf.sh && \
  70. dos2unix /root/startup.sh && \
  71. dos2unix /opt/dolphinscheduler/conf/env/dolphinscheduler_env.sh && \
  72. dos2unix /opt/dolphinscheduler/script/*.sh && \
  73. dos2unix /opt/dolphinscheduler/bin/*.sh && \
  74. dos2unix /opt/zookeeper/bin/*.sh && \
  75. rm -rf /bin/sh && \
  76. ln -s /bin/bash /bin/sh && \
  77. mkdir -p /tmp/xls
  78. #8. remove apk index cache
  79. RUN rm -rf /var/cache/apk/*
  80. #9. expose port
  81. EXPOSE 2181 2888 3888 5432 5678 1234 12345 50051 8888
  82. ENTRYPOINT ["/sbin/tini", "--", "/root/startup.sh"]