zoukankan      html  css  js  c++  java
  • Docker Alpine Dockerfile 安装nginx,最小镜像 将来

    Docker Alpine Dockerfile 安装nginx,最小镜像

    FROM alpine
    MAINTAINER will 
    
    ## 将alpine-linux:apk的安装源改为国内镜像
    RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.ustc.edu.cn/g' /etc/apk/repositories
    
    ## 安装需要编译nginx扩展
    ## 安装正则表达式pcre模块,nginx正则匹配URL
    RUN apk add wget gcc g++ make && \ 
        cd /home && \
        wget "https://ftp.pcre.org/pub/pcre/pcre-8.44.tar.gz" && \
        tar xvf pcre-8.44.tar.gz && \
        wget "http://nginx.org/download/nginx-1.18.0.tar.gz" && \
        tar xvf nginx-1.18.0.tar.gz
    
    ## 编译nginx
    RUN cd /home/nginx-1.18.0 && \
        ./configure --prefix=/usr/local/nginx --with-pcre=/home/pcre-8.44 --without-http_gzip_module && \
        make && make install && \
        ln -s /usr/local/nginx/sbin/nginx /usr/sbin/ && \
        mkdir -p /usr/local/nginx/conf/vhost/
        rm -rf /home/*
    
    ## 设置工作目录
    WORKDIR /var/www
    
    ## 启动nginx
    CMD ["nginx","-g","daemon off;"]
    
    EXPOSE 80
  • 相关阅读:
    centos 部署.NET CORE
    nginx 负载均衡
    graylog centos7 部署
    springboot 2.x centos 7.0 部署
    HashMap源代码阅读理解
    服务器安装redis
    java ---- gradle
    uboot-makefile总览
    makeFile
    Spring 推断构造方法
  • 原文地址:https://www.cnblogs.com/will-xz/p/13418347.html
Copyright © 2011-2022 走看看