From 2d4e89f175acde09025af4cdbe732110af38988e Mon Sep 17 00:00:00 2001 From: idoop Date: Sat, 24 Jul 2021 16:00:34 +0800 Subject: [PATCH] [mod] : fix BASE_URL duplicates --- Dockerfile | 2 +- README.md | 7 +++---- docker-entrypoint | 13 ++++++++----- 3 files changed, 12 insertions(+), 10 deletions(-) diff --git a/Dockerfile b/Dockerfile index f67e44e..fd5a463 100644 --- a/Dockerfile +++ b/Dockerfile @@ -8,7 +8,7 @@ RUN git clone --branch $GIT_BRANCH --depth 1 $GIT_URL /project && \ rm -rf /project/.git FROM nginx -MAINTAINER Swire Chen " +LABEL maintainer="Swire Chen " ENV APP_BASE /var/www/simple-nuget-server ENV DEFAULT_SIZE 20M diff --git a/README.md b/README.md index 9b0423e..d8e72e1 100644 --- a/README.md +++ b/README.md @@ -1,10 +1,9 @@ # docker-nuget-server -[![Docker Build Status](https://img.shields.io/docker/build/idoop/docker-nuget-server.svg)](https://hub.docker.com/r/idoop/docker-nuget-server/) +[![Docker Build Status](https://img.shields.io/docker/cloud/build/idoop/docker-nuget-server)](https://hub.docker.com/r/idoop/docker-nuget-server/) +[![Docker Automated build](https://img.shields.io/docker/automated/idoop/docker-nuget-server)](https://hub.docker.com/r/idoop/docker-nuget-server/) [![Docker Pulls](https://img.shields.io/docker/pulls/idoop/docker-nuget-server.svg)](https://hub.docker.com/r/idoop/docker-nuget-server/) -[![Docker Automated build](https://img.shields.io/docker/automated/idoop/docker-nuget-server.svg)](https://hub.docker.com/r/idoop/docker-nuget-server/) -[![ImageLayers Size](https://img.shields.io/imagelayers/image-size/idoop/docker-nuget-server/latest.svg)](https://hub.docker.com/r/idoop/docker-nuget-server/) -[![ImageLayers Layers](https://img.shields.io/imagelayers/layers/idoop/docker-nuget-server/latest.svg)](https://hub.docker.com/r/idoop/docker-nuget-server/) +[![ImageLayers Size](https://img.shields.io/docker/image-size/idoop/docker-nuget-server/latest)](https://hub.docker.com/r/idoop/docker-nuget-server/) diff --git a/docker-entrypoint b/docker-entrypoint index ed38999..28e8867 100644 --- a/docker-entrypoint +++ b/docker-entrypoint @@ -1,5 +1,7 @@ #!/bin/bash set -e +NGINX_CONF_DEFAULT="/etc/nginx/nginx.conf" +NGINX_CONF_NUGET="/etc/nginx/conf.d/nuget.conf" NGINX_FILES=`ls /etc/nginx/` if [ -z "${NGINX_FILES}" ];then chown nginx -R /etc/nginx @@ -35,7 +37,7 @@ elif [ "$#" == "0" ];then echo "Using default server name: localhost" else echo "Using specified server name: ${SERVER_NAME}" - sed -i -e "s/server_name.*/server_name ${SERVER_NAME};/" /etc/nginx/conf.d/nuget.conf + sed -e "s/server_name.*/server_name ${SERVER_NAME};/" -i ${NGINX_CONF_NUGET} fi # Set server port. @@ -43,7 +45,7 @@ elif [ "$#" == "0" ];then echo "Using default port: 80" else echo "Using specified port: ${SERVER_PORT}" - sed -i -e "s/listen.*/listen ${SERVER_PORT};/" /etc/nginx/conf.d/nuget.conf + sed -e "s/listen.*/listen ${SERVER_PORT};/" -i ${NGINX_CONF_NUGET} fi # Set Worker_Processes @@ -51,7 +53,7 @@ elif [ "$#" == "0" ];then echo "Using default nginx worker_processes: ${DEFAULT_WORKER_PROCESSES}" else echo "Using specified nginx worker_processes ${WORKER_PROCESSES}" - sed -i -e "s/worker_processes.*$/worker_processes ${WORKER_PROCESSES};/" /etc/nginx/nginx.conf + sed -e "s/worker_processes.*$/worker_processes ${WORKER_PROCESSES};/" -i ${NGINX_CONF_DEFAULT} fi # Set Worker_Connections @@ -59,12 +61,13 @@ elif [ "$#" == "0" ];then echo "Using default worker_connections: ${DEFAULT_WORKER_CONNECTIONS}" else echo "Using specified worker_connections: ${WORKER_CONNECTIONS}" - sed -i -e "s/worker_connections.*$/ worker_connections ${WORKER_CONNECTIONS};/" /etc/nginx/nginx.conf + sed -e "s/worker_connections.*$/ worker_connections ${WORKER_CONNECTIONS};/" -i ${NGINX_CONF_DEFAULT} fi if [ -n "${BASE_URL}" ];then echo "Use base URL: ${BASE_URL}" - sed -i -e "/fastcgi_temp_file_write_size.*$/a\ fastcgi_param BASE_URL ${BASE_URL};" /etc/nginx/conf.d/nuget.conf + sed -e "/fastcgi_param BASE_URL.*$/d" \ + -e "/fastcgi_temp_file_write_size.*$/a\ fastcgi_param BASE_URL ${BASE_URL};" -i ${NGINX_CONF_NUGET} fi # Set folder property.