dockernginxdockerfilejwilder-nginx-proxy

Extend Dockerfile nginx image


I've run into an nginx limiting issue that requires me to extend config of my nginx dockerfile, I found a Dockerfile extension logic listed here but I'm having trouble getting it to work, I'm not sure what I'm supposed to use for the COPY . /app/ for because I don't need to copy anything into the image to my understanding, I just need that magic script.

Here is the whole Dockerfile for reference

FROM jwilder/nginx-proxy
COPY . /app/
RUN { \ 
    # Increased the number of worker_processes from any number to 4
    sed -i 's/\(worker_processes\s*\)[0-9]*;/\14;/' /etc/nginx/nginx.conf; \
    # Increased the number of worker_connections from any number to 19000
    sed -i 's/\(worker_connections\s*\)[0-9]*;/\119000;/' /etc/nginx/nginx.conf; \
}

Removing COPY doesn't work, the build context just gets huge (over 1GB) so I'm guessing it's grabbing everything in the repo it's in.


Solution

  • It's called a derived dockerfile I found, and you need to run it in the repo for building that image (not in the repo that you're likely getting that 1GB build context from.

    So the solution:

    1. Clone the origin repo https://github.com/nginx-proxy/nginx-proxy

    2. Replace the Dockerfile with your updated one here

    3. Run your docker build command

    I just did this and pushed, publicly available as kmdanikowski/nginx-proxy but I recommend you do your own so it can be the most up to date.