Docker上的超慢到公共应用程序

Docker上的超慢到公共应用程序,docker,docker-compose,dockerfile,Docker,Docker Compose,Dockerfile,我研究了所有的东西,却找不到解决办法 我正在运行docker compose编译,它需要10到15分钟才能投入生产,这太疯狂了。我尝试了一切,尝试了擦除卷,尝试了清理整个系统,更改了网络连接,卸载/重新安装了Docker,运行了完整的Docker系统修剪-a-什么都没有 我不知道这是否是因为这个延迟,但似乎连dns都丢失了,在所有这些时间之后都找不到应用程序。我必须按ctrl+f5来加载新的更新 但这一次我快疯了,15分钟就可以把一切都准备好 谢谢你的帮助 .yml: version: '3'

我研究了所有的东西,却找不到解决办法

我正在运行docker compose编译,它需要10到15分钟才能投入生产,这太疯狂了。我尝试了一切,尝试了擦除卷,尝试了清理整个系统,更改了网络连接,卸载/重新安装了Docker,运行了完整的
Docker系统修剪-a
-什么都没有

我不知道这是否是因为这个延迟,但似乎连dns都丢失了,在所有这些时间之后都找不到应用程序。我必须按ctrl+f5来加载新的更新

但这一次我快疯了,15分钟就可以把一切都准备好

谢谢你的帮助

.yml:

version: '3'

volumes:
  app-volume:

services:

  nginx:
    container_name: nginx
    restart: always
    build:  
      context: ./nginx/
      dockerfile: ./Dockerfile
    depends_on:
      - app
    volumes:
      - app-volume:/app
    env_file:
      - ./nginx/.envs/nginx.env
    ports:
      - "80:80"
      - "443:443"

  app:
    container_name: app
    build:
      context: ./app/
      dockerfile: ./compose/production/Dockerfile
    image: app
    volumes:
      # - ./app/:/app
      - app-volume:/home/app
    env_file:
      - ./app/.envs/.production/app.env

FROM node:12-alpine as builder

WORKDIR /home/app

RUN apk update && \
    apk add --no-cache python make g++ iputils

RUN npm install -g @angular/cli

COPY package*.json ./
COPY *.lock ./

RUN yarn install --unsafe-perm

COPY . .

ARG FORCE_BUILD_ENV=1
ARG ENV_BUILD=0

RUN export $(grep -v '^#' .envs/.production/app.env | xargs) && \
    npm run build:env && \
    ls -lah && \
    cat ./src/environments/environment.ts && \
    cat ./src/environments/environment.prod.ts

CMD ["ng", "build", "--prod", "--outputPath=dist"]

FROM alpine:3.10

LABEL maintainer="NGINX Docker Maintainers <docker-maint@nginx.com>"

ENV NGINX_VERSION 1.16.1
ENV NGX_BROTLI_COMMIT e505dce68acc190cc5a1e780a3b0275e39f160ca

RUN GPG_KEYS=B0F4253373F8F6F510D42178520A9993A1C052F8 \
    && CONFIG="\
        --prefix=/etc/nginx \
        --sbin-path=/usr/sbin/nginx \
        --modules-path=/usr/lib/nginx/modules \
        --conf-path=/etc/nginx/nginx.conf \
        --error-log-path=/var/log/nginx/error.log \
        --http-log-path=/var/log/nginx/access.log \
        --pid-path=/var/run/nginx.pid \
        --lock-path=/var/run/nginx.lock \
        --http-client-body-temp-path=/var/cache/nginx/client_temp \
        --http-proxy-temp-path=/var/cache/nginx/proxy_temp \
        --http-fastcgi-temp-path=/var/cache/nginx/fastcgi_temp \
        --http-uwsgi-temp-path=/var/cache/nginx/uwsgi_temp \
        --http-scgi-temp-path=/var/cache/nginx/scgi_temp \
        --user=nginx \
        --group=nginx \
        --with-http_ssl_module \
        --with-http_realip_module \
        --with-http_addition_module \
        --with-http_sub_module \
        --with-http_dav_module \
        --with-http_flv_module \
        --with-http_mp4_module \
        --with-http_gunzip_module \
        --with-http_gzip_static_module \
        --with-http_random_index_module \
        --with-http_secure_link_module \
        --with-http_stub_status_module \
        --with-http_auth_request_module \
        --with-http_xslt_module=dynamic \
        --with-http_image_filter_module=dynamic \
        --with-http_geoip_module=dynamic \
        --with-http_perl_module=dynamic \
        --with-threads \
        --with-stream \
        --with-stream_ssl_module \
        --with-stream_ssl_preread_module \
        --with-stream_realip_module \
        --with-stream_geoip_module=dynamic \
        --with-http_slice_module \
        --with-mail \
        --with-mail_ssl_module \
        --with-compat \
        --with-file-aio \
        --with-http_v2_module \
        --add-module=/usr/src/ngx_brotli \
    " \
    && addgroup -S nginx \
    && adduser -D -S -h /var/cache/nginx -s /sbin/nologin -G nginx nginx \
    && apk add --no-cache --virtual .build-deps \
        gcc \
        libc-dev \
        make \
        openssl-dev \
        pcre-dev \
        zlib-dev \
        linux-headers \
        curl \
        gnupg1 \
        libxslt-dev \
        gd-dev \
        geoip-dev \
        perl-dev \
    && apk add --no-cache --virtual .brotli-build-deps \
        autoconf \
        libtool \
        automake \
        git \
        g++ \
        cmake \
    && mkdir -p /usr/src \
    && cd /usr/src \
    && git clone --recursive https://github.com/google/ngx_brotli.git \
    && cd ngx_brotli \
    && git checkout -b $NGX_BROTLI_COMMIT $NGX_BROTLI_COMMIT \
    && cd .. \
    && curl -fSL https://nginx.org/download/nginx-$NGINX_VERSION.tar.gz -o nginx.tar.gz \
    && curl -fSL https://nginx.org/download/nginx-$NGINX_VERSION.tar.gz.asc  -o nginx.tar.gz.asc \
        && sha512sum nginx.tar.gz nginx.tar.gz.asc \
    && export GNUPGHOME="$(mktemp -d)" \
    && gpg --keyserver ipv4.pool.sks-keyservers.net --recv-keys "$GPG_KEYS" \
    && gpg --batch --verify nginx.tar.gz.asc nginx.tar.gz \
    && rm -rf "$GNUPGHOME" nginx.tar.gz.asc \
    && mkdir -p /usr/src \
    && tar -zxC /usr/src -f nginx.tar.gz \
    && rm nginx.tar.gz \
    && cd /usr/src/nginx-$NGINX_VERSION \
    && ./configure $CONFIG --with-debug \
    && make -j$(getconf _NPROCESSORS_ONLN) \
    && mv objs/nginx objs/nginx-debug \
    && mv objs/ngx_http_xslt_filter_module.so objs/ngx_http_xslt_filter_module-debug.so \
    && mv objs/ngx_http_image_filter_module.so objs/ngx_http_image_filter_module-debug.so \
    && mv objs/ngx_http_geoip_module.so objs/ngx_http_geoip_module-debug.so \
    && mv objs/ngx_http_perl_module.so objs/ngx_http_perl_module-debug.so \
    && mv objs/ngx_stream_geoip_module.so objs/ngx_stream_geoip_module-debug.so \
    && ./configure $CONFIG \
    && make -j$(getconf _NPROCESSORS_ONLN) \
    && make install \
    && rm -rf /etc/nginx/html/ \
    && mkdir /etc/nginx/conf.d/ \
    && mkdir -p /usr/share/nginx/html/ \
    && install -m644 html/index.html /usr/share/nginx/html/ \
    && install -m644 html/50x.html /usr/share/nginx/html/ \
    && install -m755 objs/nginx-debug /usr/sbin/nginx-debug \
    && install -m755 objs/ngx_http_xslt_filter_module-debug.so /usr/lib/nginx/modules/ngx_http_xslt_filter_module-debug.so \
    && install -m755 objs/ngx_http_image_filter_module-debug.so /usr/lib/nginx/modules/ngx_http_image_filter_module-debug.so \
    && install -m755 objs/ngx_http_geoip_module-debug.so /usr/lib/nginx/modules/ngx_http_geoip_module-debug.so \
    && install -m755 objs/ngx_http_perl_module-debug.so /usr/lib/nginx/modules/ngx_http_perl_module-debug.so \
    && install -m755 objs/ngx_stream_geoip_module-debug.so /usr/lib/nginx/modules/ngx_stream_geoip_module-debug.so \
    && ln -s ../../usr/lib/nginx/modules /etc/nginx/modules \
    && strip /usr/sbin/nginx* \
    && strip /usr/lib/nginx/modules/*.so \
    && rm -rf /usr/src/nginx-$NGINX_VERSION \
    && rm -rf /usr/src/ngx_brotli \
    \
    # Bring in gettext so we can get `envsubst`, then throw
    # the rest away. To do this, we need to install `gettext`
    # then move `envsubst` out of the way so `gettext` can
    # be deleted completely, then move `envsubst` back.
    && apk add --no-cache --virtual .gettext gettext \
    && mv /usr/bin/envsubst /tmp/ \
    \
    && runDeps="$( \
        scanelf --needed --nobanner /usr/sbin/nginx /usr/lib/nginx/modules/*.so /tmp/envsubst \
            | awk '{ gsub(/,/, "\nso:", $2); print "so:" $2 }' \
            | sort -u \
            | xargs -r apk info --installed \
            | sort -u \
    )" \
    && apk add --no-cache --virtual .nginx-rundeps tzdata $runDeps \
    && apk del .build-deps \
    && apk del .brotli-build-deps \
    && apk del .gettext \
    && mv /tmp/envsubst /usr/local/bin/ \
    \
    # forward request and error logs to docker log collector
    && ln -sf /dev/stdout /var/log/nginx/access.log \
    && ln -sf /dev/stderr /var/log/nginx/error.log

RUN echo "http://dl-cdn.alpinelinux.org/alpine/edge/testing" >> /etc/apk/repositories && \
    apk update && \
    apk add --no-cache openssl brotli vim && \
    rm -rf /var/cache/apk/*


RUN mkdir -p /etc/ssl/certs/private/ 

COPY ./server.crt /etc/ssl/certs/private/siap.crt
COPY ./server.key /etc/ssl/certs/private/siap.key

RUN openssl dhparam -out /etc/ssl/certs/private/dhparam.pem 4096

RUN rm -rf /etc/nginx/conf.d/*

COPY ./scripts/nginx.conf /etc/nginx/nginx.conf
COPY ./scripts/conf.d/brotli.conf /etc/nginx/conf.d/brotli.conf
COPY ./scripts/conf.d/siap.http.conf /etc/nginx/conf.d/siap.http.conf
COPY ./scripts/conf.d/siap.https.conf /etc/nginx/conf.d/siap.https.conf

COPY .envs ./.envs

RUN export $(grep -v '^#' .envs/nginx.env | xargs) && \
    sed -i '2s/^.*$/    server '$SERVER_ENDERECO';/g' /etc/nginx/conf.d/siap.https.conf;

EXPOSE 80

STOPSIGNAL SIGTERM

RUN head /etc/nginx/conf.d/siap.https.conf
# RUN nginx -t

CMD ["nginx", "-g", "daemon off;"]
应用程序文件:

version: '3'

volumes:
  app-volume:

services:

  nginx:
    container_name: nginx
    restart: always
    build:  
      context: ./nginx/
      dockerfile: ./Dockerfile
    depends_on:
      - app
    volumes:
      - app-volume:/app
    env_file:
      - ./nginx/.envs/nginx.env
    ports:
      - "80:80"
      - "443:443"

  app:
    container_name: app
    build:
      context: ./app/
      dockerfile: ./compose/production/Dockerfile
    image: app
    volumes:
      # - ./app/:/app
      - app-volume:/home/app
    env_file:
      - ./app/.envs/.production/app.env

FROM node:12-alpine as builder

WORKDIR /home/app

RUN apk update && \
    apk add --no-cache python make g++ iputils

RUN npm install -g @angular/cli

COPY package*.json ./
COPY *.lock ./

RUN yarn install --unsafe-perm

COPY . .

ARG FORCE_BUILD_ENV=1
ARG ENV_BUILD=0

RUN export $(grep -v '^#' .envs/.production/app.env | xargs) && \
    npm run build:env && \
    ls -lah && \
    cat ./src/environments/environment.ts && \
    cat ./src/environments/environment.prod.ts

CMD ["ng", "build", "--prod", "--outputPath=dist"]

FROM alpine:3.10

LABEL maintainer="NGINX Docker Maintainers <docker-maint@nginx.com>"

ENV NGINX_VERSION 1.16.1
ENV NGX_BROTLI_COMMIT e505dce68acc190cc5a1e780a3b0275e39f160ca

RUN GPG_KEYS=B0F4253373F8F6F510D42178520A9993A1C052F8 \
    && CONFIG="\
        --prefix=/etc/nginx \
        --sbin-path=/usr/sbin/nginx \
        --modules-path=/usr/lib/nginx/modules \
        --conf-path=/etc/nginx/nginx.conf \
        --error-log-path=/var/log/nginx/error.log \
        --http-log-path=/var/log/nginx/access.log \
        --pid-path=/var/run/nginx.pid \
        --lock-path=/var/run/nginx.lock \
        --http-client-body-temp-path=/var/cache/nginx/client_temp \
        --http-proxy-temp-path=/var/cache/nginx/proxy_temp \
        --http-fastcgi-temp-path=/var/cache/nginx/fastcgi_temp \
        --http-uwsgi-temp-path=/var/cache/nginx/uwsgi_temp \
        --http-scgi-temp-path=/var/cache/nginx/scgi_temp \
        --user=nginx \
        --group=nginx \
        --with-http_ssl_module \
        --with-http_realip_module \
        --with-http_addition_module \
        --with-http_sub_module \
        --with-http_dav_module \
        --with-http_flv_module \
        --with-http_mp4_module \
        --with-http_gunzip_module \
        --with-http_gzip_static_module \
        --with-http_random_index_module \
        --with-http_secure_link_module \
        --with-http_stub_status_module \
        --with-http_auth_request_module \
        --with-http_xslt_module=dynamic \
        --with-http_image_filter_module=dynamic \
        --with-http_geoip_module=dynamic \
        --with-http_perl_module=dynamic \
        --with-threads \
        --with-stream \
        --with-stream_ssl_module \
        --with-stream_ssl_preread_module \
        --with-stream_realip_module \
        --with-stream_geoip_module=dynamic \
        --with-http_slice_module \
        --with-mail \
        --with-mail_ssl_module \
        --with-compat \
        --with-file-aio \
        --with-http_v2_module \
        --add-module=/usr/src/ngx_brotli \
    " \
    && addgroup -S nginx \
    && adduser -D -S -h /var/cache/nginx -s /sbin/nologin -G nginx nginx \
    && apk add --no-cache --virtual .build-deps \
        gcc \
        libc-dev \
        make \
        openssl-dev \
        pcre-dev \
        zlib-dev \
        linux-headers \
        curl \
        gnupg1 \
        libxslt-dev \
        gd-dev \
        geoip-dev \
        perl-dev \
    && apk add --no-cache --virtual .brotli-build-deps \
        autoconf \
        libtool \
        automake \
        git \
        g++ \
        cmake \
    && mkdir -p /usr/src \
    && cd /usr/src \
    && git clone --recursive https://github.com/google/ngx_brotli.git \
    && cd ngx_brotli \
    && git checkout -b $NGX_BROTLI_COMMIT $NGX_BROTLI_COMMIT \
    && cd .. \
    && curl -fSL https://nginx.org/download/nginx-$NGINX_VERSION.tar.gz -o nginx.tar.gz \
    && curl -fSL https://nginx.org/download/nginx-$NGINX_VERSION.tar.gz.asc  -o nginx.tar.gz.asc \
        && sha512sum nginx.tar.gz nginx.tar.gz.asc \
    && export GNUPGHOME="$(mktemp -d)" \
    && gpg --keyserver ipv4.pool.sks-keyservers.net --recv-keys "$GPG_KEYS" \
    && gpg --batch --verify nginx.tar.gz.asc nginx.tar.gz \
    && rm -rf "$GNUPGHOME" nginx.tar.gz.asc \
    && mkdir -p /usr/src \
    && tar -zxC /usr/src -f nginx.tar.gz \
    && rm nginx.tar.gz \
    && cd /usr/src/nginx-$NGINX_VERSION \
    && ./configure $CONFIG --with-debug \
    && make -j$(getconf _NPROCESSORS_ONLN) \
    && mv objs/nginx objs/nginx-debug \
    && mv objs/ngx_http_xslt_filter_module.so objs/ngx_http_xslt_filter_module-debug.so \
    && mv objs/ngx_http_image_filter_module.so objs/ngx_http_image_filter_module-debug.so \
    && mv objs/ngx_http_geoip_module.so objs/ngx_http_geoip_module-debug.so \
    && mv objs/ngx_http_perl_module.so objs/ngx_http_perl_module-debug.so \
    && mv objs/ngx_stream_geoip_module.so objs/ngx_stream_geoip_module-debug.so \
    && ./configure $CONFIG \
    && make -j$(getconf _NPROCESSORS_ONLN) \
    && make install \
    && rm -rf /etc/nginx/html/ \
    && mkdir /etc/nginx/conf.d/ \
    && mkdir -p /usr/share/nginx/html/ \
    && install -m644 html/index.html /usr/share/nginx/html/ \
    && install -m644 html/50x.html /usr/share/nginx/html/ \
    && install -m755 objs/nginx-debug /usr/sbin/nginx-debug \
    && install -m755 objs/ngx_http_xslt_filter_module-debug.so /usr/lib/nginx/modules/ngx_http_xslt_filter_module-debug.so \
    && install -m755 objs/ngx_http_image_filter_module-debug.so /usr/lib/nginx/modules/ngx_http_image_filter_module-debug.so \
    && install -m755 objs/ngx_http_geoip_module-debug.so /usr/lib/nginx/modules/ngx_http_geoip_module-debug.so \
    && install -m755 objs/ngx_http_perl_module-debug.so /usr/lib/nginx/modules/ngx_http_perl_module-debug.so \
    && install -m755 objs/ngx_stream_geoip_module-debug.so /usr/lib/nginx/modules/ngx_stream_geoip_module-debug.so \
    && ln -s ../../usr/lib/nginx/modules /etc/nginx/modules \
    && strip /usr/sbin/nginx* \
    && strip /usr/lib/nginx/modules/*.so \
    && rm -rf /usr/src/nginx-$NGINX_VERSION \
    && rm -rf /usr/src/ngx_brotli \
    \
    # Bring in gettext so we can get `envsubst`, then throw
    # the rest away. To do this, we need to install `gettext`
    # then move `envsubst` out of the way so `gettext` can
    # be deleted completely, then move `envsubst` back.
    && apk add --no-cache --virtual .gettext gettext \
    && mv /usr/bin/envsubst /tmp/ \
    \
    && runDeps="$( \
        scanelf --needed --nobanner /usr/sbin/nginx /usr/lib/nginx/modules/*.so /tmp/envsubst \
            | awk '{ gsub(/,/, "\nso:", $2); print "so:" $2 }' \
            | sort -u \
            | xargs -r apk info --installed \
            | sort -u \
    )" \
    && apk add --no-cache --virtual .nginx-rundeps tzdata $runDeps \
    && apk del .build-deps \
    && apk del .brotli-build-deps \
    && apk del .gettext \
    && mv /tmp/envsubst /usr/local/bin/ \
    \
    # forward request and error logs to docker log collector
    && ln -sf /dev/stdout /var/log/nginx/access.log \
    && ln -sf /dev/stderr /var/log/nginx/error.log

RUN echo "http://dl-cdn.alpinelinux.org/alpine/edge/testing" >> /etc/apk/repositories && \
    apk update && \
    apk add --no-cache openssl brotli vim && \
    rm -rf /var/cache/apk/*


RUN mkdir -p /etc/ssl/certs/private/ 

COPY ./server.crt /etc/ssl/certs/private/siap.crt
COPY ./server.key /etc/ssl/certs/private/siap.key

RUN openssl dhparam -out /etc/ssl/certs/private/dhparam.pem 4096

RUN rm -rf /etc/nginx/conf.d/*

COPY ./scripts/nginx.conf /etc/nginx/nginx.conf
COPY ./scripts/conf.d/brotli.conf /etc/nginx/conf.d/brotli.conf
COPY ./scripts/conf.d/siap.http.conf /etc/nginx/conf.d/siap.http.conf
COPY ./scripts/conf.d/siap.https.conf /etc/nginx/conf.d/siap.https.conf

COPY .envs ./.envs

RUN export $(grep -v '^#' .envs/nginx.env | xargs) && \
    sed -i '2s/^.*$/    server '$SERVER_ENDERECO';/g' /etc/nginx/conf.d/siap.https.conf;

EXPOSE 80

STOPSIGNAL SIGTERM

RUN head /etc/nginx/conf.d/siap.https.conf
# RUN nginx -t

CMD ["nginx", "-g", "daemon off;"]
nginx/Dockerfile:

version: '3'

volumes:
  app-volume:

services:

  nginx:
    container_name: nginx
    restart: always
    build:  
      context: ./nginx/
      dockerfile: ./Dockerfile
    depends_on:
      - app
    volumes:
      - app-volume:/app
    env_file:
      - ./nginx/.envs/nginx.env
    ports:
      - "80:80"
      - "443:443"

  app:
    container_name: app
    build:
      context: ./app/
      dockerfile: ./compose/production/Dockerfile
    image: app
    volumes:
      # - ./app/:/app
      - app-volume:/home/app
    env_file:
      - ./app/.envs/.production/app.env

FROM node:12-alpine as builder

WORKDIR /home/app

RUN apk update && \
    apk add --no-cache python make g++ iputils

RUN npm install -g @angular/cli

COPY package*.json ./
COPY *.lock ./

RUN yarn install --unsafe-perm

COPY . .

ARG FORCE_BUILD_ENV=1
ARG ENV_BUILD=0

RUN export $(grep -v '^#' .envs/.production/app.env | xargs) && \
    npm run build:env && \
    ls -lah && \
    cat ./src/environments/environment.ts && \
    cat ./src/environments/environment.prod.ts

CMD ["ng", "build", "--prod", "--outputPath=dist"]

FROM alpine:3.10

LABEL maintainer="NGINX Docker Maintainers <docker-maint@nginx.com>"

ENV NGINX_VERSION 1.16.1
ENV NGX_BROTLI_COMMIT e505dce68acc190cc5a1e780a3b0275e39f160ca

RUN GPG_KEYS=B0F4253373F8F6F510D42178520A9993A1C052F8 \
    && CONFIG="\
        --prefix=/etc/nginx \
        --sbin-path=/usr/sbin/nginx \
        --modules-path=/usr/lib/nginx/modules \
        --conf-path=/etc/nginx/nginx.conf \
        --error-log-path=/var/log/nginx/error.log \
        --http-log-path=/var/log/nginx/access.log \
        --pid-path=/var/run/nginx.pid \
        --lock-path=/var/run/nginx.lock \
        --http-client-body-temp-path=/var/cache/nginx/client_temp \
        --http-proxy-temp-path=/var/cache/nginx/proxy_temp \
        --http-fastcgi-temp-path=/var/cache/nginx/fastcgi_temp \
        --http-uwsgi-temp-path=/var/cache/nginx/uwsgi_temp \
        --http-scgi-temp-path=/var/cache/nginx/scgi_temp \
        --user=nginx \
        --group=nginx \
        --with-http_ssl_module \
        --with-http_realip_module \
        --with-http_addition_module \
        --with-http_sub_module \
        --with-http_dav_module \
        --with-http_flv_module \
        --with-http_mp4_module \
        --with-http_gunzip_module \
        --with-http_gzip_static_module \
        --with-http_random_index_module \
        --with-http_secure_link_module \
        --with-http_stub_status_module \
        --with-http_auth_request_module \
        --with-http_xslt_module=dynamic \
        --with-http_image_filter_module=dynamic \
        --with-http_geoip_module=dynamic \
        --with-http_perl_module=dynamic \
        --with-threads \
        --with-stream \
        --with-stream_ssl_module \
        --with-stream_ssl_preread_module \
        --with-stream_realip_module \
        --with-stream_geoip_module=dynamic \
        --with-http_slice_module \
        --with-mail \
        --with-mail_ssl_module \
        --with-compat \
        --with-file-aio \
        --with-http_v2_module \
        --add-module=/usr/src/ngx_brotli \
    " \
    && addgroup -S nginx \
    && adduser -D -S -h /var/cache/nginx -s /sbin/nologin -G nginx nginx \
    && apk add --no-cache --virtual .build-deps \
        gcc \
        libc-dev \
        make \
        openssl-dev \
        pcre-dev \
        zlib-dev \
        linux-headers \
        curl \
        gnupg1 \
        libxslt-dev \
        gd-dev \
        geoip-dev \
        perl-dev \
    && apk add --no-cache --virtual .brotli-build-deps \
        autoconf \
        libtool \
        automake \
        git \
        g++ \
        cmake \
    && mkdir -p /usr/src \
    && cd /usr/src \
    && git clone --recursive https://github.com/google/ngx_brotli.git \
    && cd ngx_brotli \
    && git checkout -b $NGX_BROTLI_COMMIT $NGX_BROTLI_COMMIT \
    && cd .. \
    && curl -fSL https://nginx.org/download/nginx-$NGINX_VERSION.tar.gz -o nginx.tar.gz \
    && curl -fSL https://nginx.org/download/nginx-$NGINX_VERSION.tar.gz.asc  -o nginx.tar.gz.asc \
        && sha512sum nginx.tar.gz nginx.tar.gz.asc \
    && export GNUPGHOME="$(mktemp -d)" \
    && gpg --keyserver ipv4.pool.sks-keyservers.net --recv-keys "$GPG_KEYS" \
    && gpg --batch --verify nginx.tar.gz.asc nginx.tar.gz \
    && rm -rf "$GNUPGHOME" nginx.tar.gz.asc \
    && mkdir -p /usr/src \
    && tar -zxC /usr/src -f nginx.tar.gz \
    && rm nginx.tar.gz \
    && cd /usr/src/nginx-$NGINX_VERSION \
    && ./configure $CONFIG --with-debug \
    && make -j$(getconf _NPROCESSORS_ONLN) \
    && mv objs/nginx objs/nginx-debug \
    && mv objs/ngx_http_xslt_filter_module.so objs/ngx_http_xslt_filter_module-debug.so \
    && mv objs/ngx_http_image_filter_module.so objs/ngx_http_image_filter_module-debug.so \
    && mv objs/ngx_http_geoip_module.so objs/ngx_http_geoip_module-debug.so \
    && mv objs/ngx_http_perl_module.so objs/ngx_http_perl_module-debug.so \
    && mv objs/ngx_stream_geoip_module.so objs/ngx_stream_geoip_module-debug.so \
    && ./configure $CONFIG \
    && make -j$(getconf _NPROCESSORS_ONLN) \
    && make install \
    && rm -rf /etc/nginx/html/ \
    && mkdir /etc/nginx/conf.d/ \
    && mkdir -p /usr/share/nginx/html/ \
    && install -m644 html/index.html /usr/share/nginx/html/ \
    && install -m644 html/50x.html /usr/share/nginx/html/ \
    && install -m755 objs/nginx-debug /usr/sbin/nginx-debug \
    && install -m755 objs/ngx_http_xslt_filter_module-debug.so /usr/lib/nginx/modules/ngx_http_xslt_filter_module-debug.so \
    && install -m755 objs/ngx_http_image_filter_module-debug.so /usr/lib/nginx/modules/ngx_http_image_filter_module-debug.so \
    && install -m755 objs/ngx_http_geoip_module-debug.so /usr/lib/nginx/modules/ngx_http_geoip_module-debug.so \
    && install -m755 objs/ngx_http_perl_module-debug.so /usr/lib/nginx/modules/ngx_http_perl_module-debug.so \
    && install -m755 objs/ngx_stream_geoip_module-debug.so /usr/lib/nginx/modules/ngx_stream_geoip_module-debug.so \
    && ln -s ../../usr/lib/nginx/modules /etc/nginx/modules \
    && strip /usr/sbin/nginx* \
    && strip /usr/lib/nginx/modules/*.so \
    && rm -rf /usr/src/nginx-$NGINX_VERSION \
    && rm -rf /usr/src/ngx_brotli \
    \
    # Bring in gettext so we can get `envsubst`, then throw
    # the rest away. To do this, we need to install `gettext`
    # then move `envsubst` out of the way so `gettext` can
    # be deleted completely, then move `envsubst` back.
    && apk add --no-cache --virtual .gettext gettext \
    && mv /usr/bin/envsubst /tmp/ \
    \
    && runDeps="$( \
        scanelf --needed --nobanner /usr/sbin/nginx /usr/lib/nginx/modules/*.so /tmp/envsubst \
            | awk '{ gsub(/,/, "\nso:", $2); print "so:" $2 }' \
            | sort -u \
            | xargs -r apk info --installed \
            | sort -u \
    )" \
    && apk add --no-cache --virtual .nginx-rundeps tzdata $runDeps \
    && apk del .build-deps \
    && apk del .brotli-build-deps \
    && apk del .gettext \
    && mv /tmp/envsubst /usr/local/bin/ \
    \
    # forward request and error logs to docker log collector
    && ln -sf /dev/stdout /var/log/nginx/access.log \
    && ln -sf /dev/stderr /var/log/nginx/error.log

RUN echo "http://dl-cdn.alpinelinux.org/alpine/edge/testing" >> /etc/apk/repositories && \
    apk update && \
    apk add --no-cache openssl brotli vim && \
    rm -rf /var/cache/apk/*


RUN mkdir -p /etc/ssl/certs/private/ 

COPY ./server.crt /etc/ssl/certs/private/siap.crt
COPY ./server.key /etc/ssl/certs/private/siap.key

RUN openssl dhparam -out /etc/ssl/certs/private/dhparam.pem 4096

RUN rm -rf /etc/nginx/conf.d/*

COPY ./scripts/nginx.conf /etc/nginx/nginx.conf
COPY ./scripts/conf.d/brotli.conf /etc/nginx/conf.d/brotli.conf
COPY ./scripts/conf.d/siap.http.conf /etc/nginx/conf.d/siap.http.conf
COPY ./scripts/conf.d/siap.https.conf /etc/nginx/conf.d/siap.https.conf

COPY .envs ./.envs

RUN export $(grep -v '^#' .envs/nginx.env | xargs) && \
    sed -i '2s/^.*$/    server '$SERVER_ENDERECO';/g' /etc/nginx/conf.d/siap.https.conf;

EXPOSE 80

STOPSIGNAL SIGTERM

RUN head /etc/nginx/conf.d/siap.https.conf
# RUN nginx -t

CMD ["nginx", "-g", "daemon off;"]
来自阿尔卑斯山的
:3.10
标签维护者=“NGINX Docker维护者”
ENV NGINX_版本1.16.1
环境NGX_BROTLI_提交e505dce68acc190cc5a1e780a3b0275e39f160ca
运行GPG_KEYS=B0F4253373F8F6F510D42178520A9993A1C052F8\
&&配置=”\
--前缀=/etc/nginx\
--sbin路径=/usr/sbin/nginx\
--模块路径=/usr/lib/nginx/modules\
--conf path=/etc/nginx/nginx.conf\
--错误日志路径=/var/log/nginx/error.log\
--http日志路径=/var/log/nginx/access.log\
--pid路径=/var/run/nginx.pid\
--锁路径=/var/run/nginx.lock\
--http客户端主体临时路径=/var/cache/nginx/client\u temp\
--http代理临时路径=/var/cache/nginx/proxy\u temp\
--http fastcgi temp path=/var/cache/nginx/fastcgi\u temp\
--http-uwsgi-temp-path=/var/cache/nginx/uwsgi\u-temp\
--http scgi temp path=/var/cache/nginx/scgi_temp\
--用户=nginx\
--组=nginx\
--with-http_ssl_模块\
--with-http_realip_模块\
--with-http_添加_模块\
--with-http_子_模块\
--with-http_dav_模块\
--with-http_flv_模块\
--with-http_mp4_模块\
--with-http_gunzip_模块\
--with-http_gzip_静态_模块\
--with-http_随机_索引_模块\
--with-http\u安全链接\u模块\
--with-http_存根_状态_模块\
--with-http认证请求模块\
--with-http_xslt_module=dynamic\
--with-http\图像\过滤器\模块=动态\
--with-http_geoip_module=dynamic\
--with-http_perl_module=dynamic\
--带螺纹\
--顺流而下\
--带数据流\u ssl\u模块\
--带数据流\u ssl\u预读\u模块\
--具有流式_realip _模块\
--带-stream_geoip_模块=动态\
--with-http_切片_模块\
--用邮件\
--带电子邮件\u ssl\u模块\
--与同胞\
--档案扣押令\
--with-http_v2_模块\
--添加模块=/usr/src/ngx_brotli\
" \
&&addgroup-S nginx\
&&adduser-D-S-h/var/cache/nginx-S/sbin/nologin-G nginx nginx\
&&apk add--无缓存--虚拟.build deps\
海湾合作委员会\
图书馆发展\
制造\
openssl开发\
pcre开发\
zlib开发\
linux头文件\
卷曲\
gnupg1\
libxslt开发\
广东发展局\
地理信息平台开发\
perl开发\
&&apk add--无缓存--virtual.brotli生成deps\
自动通信\
利布托\
汽车制造商\
吉特\
g++\
克马克\
&&mkdir-p/usr/src\
&&cd/usr/src\
&&git克隆——递归https://github.com/google/ngx_brotli.git \
&&cd ngx_brotli\
&&git签出-b$NGX_BROTLI_提交$NGX_BROTLI_提交\
&&cd\
&&curl-fSLhttps://nginx.org/download/nginx-$NGINX_VERSION.tar.gz-o NGINX.tar.gz\
&&curl-fSLhttps://nginx.org/download/nginx-$NGINX_VERSION.tar.gz.asc-o NGINX.tar.gz.asc\
&&sha512sum nginx.tar.gz nginx.tar.gz.asc\
&&export GNUPGHOME=“$(mktemp-d)”\
&&gpg--keyserver ipv4.pool.sks-keyserver.net--recv keys“$gpg_keys”\
&&gpg—批处理—验证nginx.tar.gz.asc nginx.tar.gz\
&&rm-rf“$GNUPGHOME”nginx.tar.gz.asc\
&&mkdir-p/usr/src\
&&tar-zxC/usr/src-f nginx.tar.gz\
&&rm nginx.tar.gz\
&&cd/usr/src/nginx-$nginx\u版本\
&&./configure$CONFIG--with debug\
&&make-j$(仅获取配置处理器)\
&&mv objs/nginx objs/nginx调试\
&&mv objs/ngx_http_xslt_filter_module.so objs/ngx_http_xslt_filter_module-debug.so\
&&mv objs/ngx_http_image_filter_module.so objs/ngx_http_image_filter_module-debug.so\
&&mv objs/ngx_http_geoip_module.so objs/ngx_http_geoip_module-debug.so\
&&mv objs/ngx_http_perl_module.so objs/ngx_http_perl_module-debug.so\
&&mv objs/ngx_stream\u geoip_module.so objs/ngx_stream\u geoip_module-debug.so\
&&/配置$CONFIG\
&&make-j$(仅获取配置处理器)\
&&安装\
&&rm-rf/etc/nginx/html/\
&&mkdir/etc/nginx/conf.d/\
&&mkdir-p/usr/share/nginx/html/\
&&安装-m644html/index.html/usr/share/nginx/html/\
&&安装-m644html/50x.html/usr/share/nginx/html/\
&&安装-m755 objs/nginx debug/usr/sbin/nginx debug\
&&安装-m755 objs/ngx\u http\u xslt\u filter\u module-debug.so/usr/lib/nginx/modules/ngx\u http\u xslt\u filter\u module-debug.so\
&&安装-m755 objs/ngx\u http\u image\u filter\u module-debug.so/usr/lib/nginx/modules/ngx\u http\u image\u filter\u module-debug.so\
&&安装-m755 objs/ngx_http_geoip_module-debug.so/usr/lib/nginx/modules/ngx_http_geoip_module-debug.so\
&&安装-m755 objs/ngx_http_perl_module-debug.so/usr/lib/nginx/modules/ngx_http_perl_module-debug.so\
&&安装-m755 objs/ngx_stream\u geoip_module-debug.so/usr/lib/nginx/modules/ngx_stream\u geoip_module-debug.so\
&&ln-s.././usr/lib/nginx/modules/etc/nginx/modules\
&&strip/usr/sbin/nginx*\
&&strip/usr/lib/nginx/modules/*.so\
&&rm-rf/usr/src/nginx-$nginx\u版本\
&&rm-rf/usr/src/ngx\u br