Dockerfile 3.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. FROM centos:7
  2. LABEL maintainer "c-wms"
  3. ENV FASTDFS_PATH=/opt/fdfs \
  4. FASTDFS_BASE_PATH=/var/fdfs \
  5. PORT= \
  6. GROUP_NAME= \
  7. TRACKER_SERVER=
  8. #get all the dependences
  9. RUN yum install -y git gcc make wget unzip vixie-cron \
  10. pcre pcre-devel openssl openssl-devel lua-devel \
  11. readline readline-devel perl-ExtUtils-Embed \
  12. libjpeg libjpeg-devel libpng libpng-devel giflib giflib-devel freetype freetype-devel openjpeg openjpeg-devel \
  13. GraphicsMagick GraphicsMagick-devel && \
  14. yum clean all
  15. #create the dirs to store the files downloaded from internet
  16. RUN mkdir -p ${FASTDFS_PATH}/libfastcommon \
  17. && mkdir -p ${FASTDFS_PATH}/fastdfs \
  18. && mkdir ${FASTDFS_BASE_PATH}
  19. #compile the libfastcommon
  20. WORKDIR ${FASTDFS_PATH}/libfastcommon
  21. RUN git clone https://github.com/happyfish100/libfastcommon.git ${FASTDFS_PATH}/libfastcommon \
  22. && ./make.sh \
  23. && ./make.sh install \
  24. && rm -rf ${FASTDFS_PATH}/libfastcommon
  25. #compile the fastdfs
  26. WORKDIR ${FASTDFS_PATH}/fastdfs
  27. RUN git clone https://github.com/happyfish100/fastdfs.git ${FASTDFS_PATH}/fastdfs \
  28. && ./make.sh \
  29. && ./make.sh install \
  30. && rm -rf ${FASTDFS_PATH}/fastdfs
  31. COPY conf/*.* /etc/fdfs/
  32. # Set timezone
  33. RUN cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
  34. # Ready
  35. RUN groupadd nginx && \
  36. useradd -g nginx nginx -s /bin/false
  37. RUN wget http://rpmfind.net/linux/centos/7.4.1708/extras/x86_64/Packages/epel-release-7-9.noarch.rpm && \
  38. rpm -ivh epel-release-7-9.noarch.rpm && \
  39. rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7
  40. # Download and install package
  41. RUN cd /tmp && \
  42. git clone https://github.com/LuaJIT/LuaJIT.git && \
  43. git clone https://github.com/simpl/ngx_devel_kit.git && \
  44. git clone https://github.com/openresty/lua-nginx-module.git && \
  45. git clone https://github.com/openresty/echo-nginx-module.git && \
  46. git clone https://github.com/FRiCKLE/ngx_cache_purge.git && \
  47. git clone https://github.com/happyfish100/fastdfs-nginx-module.git && \
  48. wget http://nginx.org/download/nginx-1.9.15.tar.gz
  49. RUN cd /tmp && \
  50. tar zxvf nginx-1.9.15.tar.gz && \
  51. cd LuaJIT && \
  52. make && make install PREFIX=/usr/local/lj2 && \
  53. export LUAJIT_LIB=/usr/local/lj2/lib && \
  54. export LUAJIT_INC=/usr/local/lj2/include/luajit-2.0 && \
  55. cd ../nginx-1.9.15 && \
  56. ./configure --prefix=/usr/local/nginx --user=nginx --group=nginx --with-http_stub_status_module --with-http_ssl_module --with-http_realip_module --with-http_addition_module --with-http_sub_module --with-http_dav_module --with-http_flv_module --with-http_gzip_static_module --add-module=/tmp/ngx_cache_purge --add-module=/tmp/fastdfs-nginx-module/src --add-module=/tmp/ngx_devel_kit --add-module=/tmp/echo-nginx-module/ --with-ld-opt=-Wl,-rpath,/usr/local/lj2/lib --add-module=/tmp/lua-nginx-module/ && \
  57. make && make install && \
  58. mv /usr/local/nginx/conf/nginx.conf /usr/local/nginx/conf/nginx.conf.bak && \
  59. mkdir /usr/local/nginx/conf/lua && \
  60. echo "0 2 * * * find /var/fdfs/data/ -name *.*_*x*.* -atime -7 | xargs rm -rf" >> /etc/crontab && \
  61. cp /tmp/fastdfs-nginx-module/src/mod_fastdfs.conf /etc/fdfs/ && \
  62. sed -i 's:base_path=.*:base_path=/var/fdfs:g' /etc/fdfs/mod_fastdfs.conf && \
  63. sed -i 's:store_path0=.*:store_path0=/var/fdfs:g' /etc/fdfs/mod_fastdfs.conf && \
  64. rm -rf /tmp/*
  65. VOLUME ["$FASTDFS_BASE_PATH", "/etc/fdfs"]
  66. # Cpoy File
  67. COPY file/nginx.conf /usr/local/nginx/conf/
  68. COPY file/thumbnail.lua /usr/local/nginx/conf/lua/
  69. COPY docker-entrypoint.sh /
  70. #make the docker-entrypoint.sh executable
  71. RUN chmod 777 /docker-entrypoint.sh
  72. ENTRYPOINT ["/docker-entrypoint.sh"]
  73. CMD ["tracker"]