Ubuntu制作nginx镜像

Ubuntu制作nginx镜像

#基础镜像
FROM ubantu:18.04
LABEL maintanier="miaosenguo 952726682@qq.com"
RUN apt update && apt install -y iproute2 ntpdate tcpdump telnet traceroute nfs-kernrl-server ngs-common lrzsz tree openssl libssl-dev libcre3 libpcre3 libpcre3-dev zliblg-dev tcpdumo gcc openssh-server zip
#nginx镜像
RUN groupadd -g 2020 nignx && useradd -g nginx -s /usr/sbin/nologin -u 2020 nginx

ADD nginx-1.16.1.tar.fz /usr/local/src

RUN cd /usr/local/src/nginx-1.16.1 && ./config --prefix=/app/nginx && make && make install && ln -sv /app/nginx/sbin/nginx /usr/bin

#业务镜像
#配置文件
COPY nginx.conf /app/nginx/conf/nginx.conf

#添加静态文件
ADD static.tar.gz /data/nginx/html
RUN cd /app/nginx/html && unzip static.zip && rm -rf static.zip && chown -R nginx.nginx /data/nginx /app/nginx

CMD ["nginx"]
posted @ 2020-08-05 13:21  Gmiao  阅读(263)  评论(0编辑  收藏  举报