From dbd5874fdf3ff900064435dd233e980f1a53cb57 Mon Sep 17 00:00:00 2001 From: alexzshl Date: Tue, 31 Jan 2023 18:44:50 +0000 Subject: [PATCH] =?UTF-8?q?update=20docker/dockerfile=5Fnetwork/Dockerfile?= =?UTF-8?q?.=201.=20=E5=BD=93=E5=89=8D=E7=9A=84=20Dockerfile=20=E4=BC=BC?= =?UTF-8?q?=E4=B9=8E=E6=97=A0=E6=B3=95=E6=9E=84=E5=BB=BA,=20=E6=A0=B9?= =?UTF-8?q?=E6=8D=AE=20info.md=20=E7=9A=84=E8=AF=B4=E6=98=8E,=20=E5=8A=A0?= =?UTF-8?q?=E5=85=A5=20=20libserverframe=20=E5=90=8E=E5=8F=AF=E4=BB=A5?= =?UTF-8?q?=E6=9E=84=E5=BB=BA=E4=BA=86=202.=20=E5=8E=9F=E6=9D=A5=E7=9A=84?= =?UTF-8?q?=20RUN=20=E8=AF=AD=E5=8F=A5=E5=A4=AA=E5=A4=8D=E6=9D=82,=20?= =?UTF-8?q?=E4=B8=8D=E5=88=A9=E4=BA=8E=20docker=20build=20=E6=97=B6?= =?UTF-8?q?=E4=BD=BF=E7=94=A8=E5=A4=9A=E9=98=B6=E6=AE=B5=E6=9E=84=E5=BB=BA?= =?UTF-8?q?=E7=BC=93=E5=AD=98=203.=20=E5=8F=A6=E5=A4=96,=20=E8=AF=B7?= =?UTF-8?q?=E6=95=99=E4=B8=80=E4=B8=8B,=20nginx=20=E5=8D=87=E7=BA=A7?= =?UTF-8?q?=E5=88=B0=E6=9C=80=E6=96=B0=E7=9A=84=201.23=20=E6=98=AF?= =?UTF-8?q?=E5=90=A6=E6=9C=89=E9=97=AE=E9=A2=98,=20=E7=9B=AE=E5=89=8D?= =?UTF-8?q?=E6=9E=84=E5=BB=BAnginx=E6=98=AF=E6=B2=A1=E6=9C=89=E9=97=AE?= =?UTF-8?q?=E9=A2=98=E7=9A=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: alexzshl --- docker/dockerfile_network/Dockerfile | 94 ++++++++++++++++++++++------ 1 file changed, 75 insertions(+), 19 deletions(-) diff --git a/docker/dockerfile_network/Dockerfile b/docker/dockerfile_network/Dockerfile index 9d5ed96..890fcf4 100644 --- a/docker/dockerfile_network/Dockerfile +++ b/docker/dockerfile_network/Dockerfile @@ -11,25 +11,81 @@ ADD conf/nginx.conf /etc/fdfs/ ADD conf/mod_fastdfs.conf /etc/fdfs # run -RUN yum install git gcc gcc-c++ make automake autoconf libtool pcre pcre-devel zlib zlib-devel openssl-devel wget vim -y \ - && cd /usr/local/src \ - && git clone https://github.com/happyfish100/libfastcommon.git --depth 1 \ - && git clone https://github.com/happyfish100/fastdfs.git --depth 1 \ - && git clone https://github.com/happyfish100/fastdfs-nginx-module.git --depth 1 \ - && wget http://nginx.org/download/nginx-1.15.4.tar.gz \ - && tar -zxvf nginx-1.15.4.tar.gz \ - && mkdir /home/dfs \ - && cd /usr/local/src/ \ - && cd libfastcommon/ \ - && ./make.sh && ./make.sh install \ - && cd ../ \ - && cd fastdfs/ \ - && ./make.sh && ./make.sh install \ - && cd ../ \ - && cd nginx-1.15.4/ \ - && ./configure --add-module=/usr/local/src/fastdfs-nginx-module/src/ \ - && make && make install \ - && chmod +x /home/fastdfs.sh +# install packages +RUN yum install git gcc gcc-c++ make automake autoconf libtool pcre pcre-devel zlib zlib-devel openssl-devel wget vim -y +# git clone libfastcommon / libserverframe / fastdfs / fastdfs-nginx-module +RUN cd /usr/local/src \ + && git clone https://gitee.com/fastdfs100/libfastcommon.git \ + && git clone https://gitee.com/fastdfs100/libserverframe.git \ + && git clone https://gitee.com/fastdfs100/fastdfs.git \ + && git clone https://gitee.com/fastdfs100/fastdfs-nginx-module.git \ + && pwd && ls +# build libfastcommon / libserverframe / fastdfs +RUN mkdir /home/dfs \ + && cd /usr/local/src \ + && pwd && ls \ + && cd libfastcommon/ \ + && ./make.sh && ./make.sh install \ + && cd ../ \ + && cd libserverframe/ \ + && ./make.sh && ./make.sh install \ + && cd ../ \ + && cd fastdfs/ \ + && ./make.sh && ./make.sh install +# download nginx and build with fastdfs-nginx-module +# 推荐 NGINX 版本: +# NGINX_VERSION=1.16.1 +# NGINX_VERSION=1.17.10 +# NGINX_VERSION=1.18.0 +# NGINX_VERSION=1.19.10 +# NGINX_VERSION=1.20.2 +# NGINX_VERSION=1.21.6 +# NGINX_VERSION=1.22.1 +# NGINX_VERSION=1.23.3 +# 可在 docker build 命令中指定使用的 nginx 版本, 例如: +# docker build --build-arg NGINX_VERSION="1.16.1" -t happyfish100/fastdfs:latest -t happyfish100/fastdfs:6.09.01 . +# docker build --build-arg NGINX_VERSION="1.19.10" -t happyfish100/fastdfs:latest -t happyfish100/fastdfs:6.09.02 . +# docker build --build-arg NGINX_VERSION="1.23.3" -t happyfish100/fastdfs:latest -t happyfish100/fastdfs:6.09.03 . +ARG NGINX_VERSION=1.16.1 +RUN cd /usr/local/src \ + && NGINX_PACKAGE=nginx-${NGINX_VERSION} \ + && NGINX_FILE=${NGINX_PACKAGE}.tar.gz \ + && wget http://nginx.org/download/${NGINX_FILE} \ + && tar -zxvf ${NGINX_FILE} \ + && pwd && ls \ + && cd /usr/local/src \ + && cd ${NGINX_PACKAGE}/ \ + && ./configure --add-module=/usr/local/src/fastdfs-nginx-module/src/ \ + && make && make install \ + && chmod +x /home/fastdfs.sh + +# 原来的 RUN 语句太复杂, 不利于 docker build 时使用多阶段构建缓存 +# RUN yum install git gcc gcc-c++ make automake autoconf libtool pcre pcre-devel zlib zlib-devel openssl-devel wget vim -y \ +# && NGINX_VERSION=1.19.9 \ +# && NGINX_PACKAGE=nginx-${NGINX_VERSION} \ +# && NGINX_FILE=${NGINX_PACKAGE}.tar.gz \ +# && cd /usr/local/src \ +# && git clone https://gitee.com/fastdfs100/libfastcommon.git \ +# && git clone https://gitee.com/fastdfs100/libserverframe.git \ +# && git clone https://gitee.com/fastdfs100/fastdfs.git \ +# && git clone https://gitee.com/fastdfs100/fastdfs-nginx-module.git \ +# && wget http://nginx.org/download/${NGINX_FILE} \ +# && tar -zxvf ${NGINX_FILE} \ +# && mkdir /home/dfs \ +# && cd /usr/local/src/ \ +# && cd libfastcommon/ \ +# && ./make.sh && ./make.sh install \ +# && cd ../ \ +# && cd libserverframe/ \ +# && ./make.sh && ./make.sh install \ +# && cd ../ \ +# && cd fastdfs/ \ +# && ./make.sh && ./make.sh install \ +# && cd ../ \ +# && cd ${NGINX_PACKAGE}/ \ +# && ./configure --add-module=/usr/local/src/fastdfs-nginx-module/src/ \ +# && make && make install \ +# && chmod +x /home/fastdfs.sh RUN ln -s /usr/local/src/fastdfs/init.d/fdfs_trackerd /etc/init.d/fdfs_trackerd \ && ln -s /usr/local/src/fastdfs/init.d/fdfs_storaged /etc/init.d/fdfs_storaged -- Gitee