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"]