-
Notifications
You must be signed in to change notification settings - Fork 3
/
Dockerfile
73 lines (60 loc) · 3.1 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
#base on docker centos
FROM centos:7
#AUTHOR
MAINTAINER imlzw <[email protected]>
#安装wget
RUN yum install -y wget
#更换yum源
RUN mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup \
&& wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo \
&& yum clean all \
&& yum makecache
#安装工具集
RUN yum install -y zlib zlib-devel pcre pcre-devel gcc gcc-c++ openssl openssl-devel libevent libevent-devel perl unzip net-tools git
#配置环境变量
ENV CENTOS_VERSION=7 \
USER_ROOT=/home/imlzw \
FASTDFS_PATH=/home/imlzw/fastdfs \
FASTDFS_STORAGE_PATH=/home/imlzw/fastdfs/storage \
FASTDFS_STORAGE_DATA_PATH=/home/imlzw/fastdfs/storage/data \
LIB_FAST_COMMON_VERSION=1.0.36 \
FASTDFS_VERSION=5.11 \
NGINX_VERSION=1.11.7 \
FASTDFS_NGINX_VERSION=5a8110f57ec55ff580260cf1fc6aa152a5a4c574
#创建必要的目录
RUN mkdir -p ${FASTDFS_PATH}/download \
&& mkdir -p ${FASTDFS_STORAGE_PATH} \
&& mkdir -p ${FASTDFS_PATH}/client \
&& mkdir -p ${FASTDFS_PATH}/mod
#下载
RUN wget "https://github.com/happyfish100/libfastcommon/archive/V${LIB_FAST_COMMON_VERSION}.tar.gz" -P ${FASTDFS_PATH}/download/libfastcommon
RUN wget "https://github.com/happyfish100/fastdfs/archive/V${FASTDFS_VERSION}.tar.gz" -P ${FASTDFS_PATH}/download/fastdfs
RUN wget https://github.com/happyfish100/fastdfs-nginx-module/archive/${FASTDFS_NGINX_VERSION}.zip -P ${FASTDFS_PATH}/download/nginx_module
RUN wget "http://nginx.org/download/nginx-${NGINX_VERSION}.tar.gz" -P ${FASTDFS_PATH}/download/nginx
RUN tar zxvf ${FASTDFS_PATH}/download/libfastcommon/V${LIB_FAST_COMMON_VERSION}.tar.gz -C ${FASTDFS_PATH}/download/libfastcommon \
&& tar zxvf ${FASTDFS_PATH}/download/fastdfs/V${FASTDFS_VERSION}.tar.gz -C ${FASTDFS_PATH}/download/fastdfs \
&& unzip ${FASTDFS_PATH}/download/nginx_module/${FASTDFS_NGINX_VERSION}.zip -d ${FASTDFS_PATH}/download/nginx_module \
&& tar zxvf ${FASTDFS_PATH}/download/nginx/nginx-${NGINX_VERSION}.tar.gz -C ${FASTDFS_PATH}/download/nginx
#安装libfastcommon
WORKDIR ${FASTDFS_PATH}/download/libfastcommon/libfastcommon-${LIB_FAST_COMMON_VERSION}
RUN ["/bin/bash", "-c", "./make.sh && ./make.sh install"]
#安装fastdfs
WORKDIR ${FASTDFS_PATH}/download/fastdfs/fastdfs-${FASTDFS_VERSION}
RUN ["/bin/bash", "-c", "./make.sh && ./make.sh install && cp conf/* /etc/fdfs/"]
#安装nginx
WORKDIR ${FASTDFS_PATH}/download/nginx/nginx-${NGINX_VERSION}
RUN ./configure --add-module=${FASTDFS_PATH}/download/nginx_module/fastdfs-nginx-module-${FASTDFS_NGINX_VERSION}/src \
&& make \
&& make install \
&& cp ${FASTDFS_PATH}/download/nginx_module/fastdfs-nginx-module-${FASTDFS_NGINX_VERSION}/src/mod_fastdfs.conf /etc/fdfs/
#添加初始化配置
RUN cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
COPY fdht_config/* /etc/fdht/
COPY fdfs_config/* /etc/fdfs/
COPY nginx_config/nginx.conf /usr/local/nginx/conf/nginx.conf
COPY ["start","stop","/home/imlzw/"]
RUN chmod +x /home/imlzw/start \
&& chmod +x /home/imlzw/stop \
&& ln -s /home/imlzw/start /usr/local/bin/start_fdfs \
&& ln -s /home/imlzw/stop /usr/local/bin/stop_fdfs
CMD ["bash","start_fdfs"]