Skip to content

Commit

Permalink
Initial commit.
Browse files Browse the repository at this point in the history
  • Loading branch information
bdh92123 committed Oct 31, 2016
0 parents commit 35ade2c
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 0 deletions.
7 changes: 7 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
FROM nginx:1.10-alpine

COPY run.sh /root/run.sh

RUN apk add --no-cache bash jq

ENTRYPOINT ["/bin/bash", "/root/run.sh"]
30 changes: 30 additions & 0 deletions run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
cd /etc/nginx/conf.d

rm -rf config* test*

echo "$1" > config
echo "$2" > test

cat config
cat test

jq .config config | xargs echo -e > temp_config

cp default.conf default.conf.bak

cat temp_config | while read a; do if [[ ! $a = \#* ]]; then echo $a >> temp_delcomment; fi done
config=`cat temp_delcomment`
config="server{ rewrite_log on; listen 80; error_log /var/log/nginx/rewrite.log notice; ${config} }"
echo $config > default.conf

nginx

jq -r 'map(.|"wget -s http://127.0.0.1/"+.)[]' test > request.sh
chmod 755 request.sh
sh request.sh

echo "###START_RESULT###"
cat /var/log/nginx/rewrite.log
echo "###END_RESULT###"

rm -rf test* temp* config*

0 comments on commit 35ade2c

Please sign in to comment.