nginx的扩展镜像
支持arm64和amd64的基础镜像,包含以下脚本文件
- wait-for-it.sh
- before_shell_runner.sh
- before_shell_appconfig_prod.sh
- staneee/nginx:1.19.6-basic
运行nginx之前,读取环境变量 RUN_BEFORE_SHELL
中的内容生成shell脚本执行
- staneee/nginx:1.19.6-shell-runner
RUN_BEFORE_SHELL='cd "/usr/share/nginx/html/assets" || exit
cat >/usr/share/nginx/html/index.html <<EOF
<h1>HelloWorld</h1>
EOF
sed -i "s/\"remoteServiceBaseUrl\": \".*\"/\"remoteServiceBaseUrl\": \"http://testapi.baidu.com\"/g" ./appconfig.prod.json
'
docker run -rm \
-e "RUN_BEFORE_SHELL=$RUN_BEFORE_SHELL" \
--name=test1 staneee/nginx:1.19.6-shell-runner
运行nginx之前,读取环境变量 APPCONFIG
中的内容,写入到 /usr/share/nginx/html/assets/appconfig.prod.json 文件中
- staneee/nginx:1.19.6-appconfig-prod
- staneee/nginx:1.19.6-appconfig-prod
APPCONFIG='{
"remoteServiceBaseUrl": "https://api.baidu.com",
"uploadApiUrl": "/api/File/Upload",
"portalBaseUrl": "https://www.baidu.com"
}'
docker run -rm \
-e "APPCONFIG=$APPCONFIG" \
--name=test1 staneee/nginx:1.19.6-appconfig-prod
支持 wait-for-it.sh 的镜像,通过传入环境变量进行控制
环境变量:
- NGINX_WAITHOST
- 等待的服务地址,默认为 localhost
- NGINX_WAITPORT
- 等待的服务端口,默认为 80
- staneee/nginx:1.19.6-wait-for-it
docker run --rm \
-p 9999:80 \
-e NGINX_WAITHOST=192.168.1.2 \
-e NGINX_WAITPORT=22 \
staneee/nginx:1.19.6-wait-for-it