Skip to content

Commit

Permalink
[mod] : fix BASE_URL duplicates
Browse files Browse the repository at this point in the history
  • Loading branch information
idoop committed Jul 24, 2021
1 parent 4f1999b commit 2d4e89f
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 10 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ RUN git clone --branch $GIT_BRANCH --depth 1 $GIT_URL /project && \
rm -rf /project/.git

FROM nginx
MAINTAINER Swire Chen <[email protected]>"
LABEL maintainer="Swire Chen <[email protected]>"

ENV APP_BASE /var/www/simple-nuget-server
ENV DEFAULT_SIZE 20M
Expand Down
7 changes: 3 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -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/)



Expand Down
13 changes: 8 additions & 5 deletions docker-entrypoint
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -35,36 +37,37 @@ 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.
if [ -z ${SERVER_PORT} ];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
if [ -z ${WORKER_PROCESSES} ];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
if [ -z ${WORKER_CONNECTIONS} ];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.
Expand Down

0 comments on commit 2d4e89f

Please sign in to comment.