:-) 🏕

Handling Environment Variables with NGINX

Number of word 904

NGINX with docker

Dockerfile

FROM nginx:1.17.1-alpine
COPY ./nginx.conf /etc/nginx/nginx.conf
COPY ./conf.d/default.conf /etc/nginx/template/nginx.tpl.default.conf
COPY ./bin/docker-endpoint.sh /bin/docker-endpoint.sh
ENTRYPOINT ["bin/docker-endpoint.sh"]
#!/bin/ash
cat /etc/nginx/template/nginx.tpl.default.conf \
  | envsubst '$SERVER_NAME' \
  > /etc/nginx/conf.d/default.conf

echo "###############################"
echo "# SERVER_NAME=${SERVER_NAME}"
echo "###############################"

/usr/sbin/nginx -g 'daemon off;' -c /etc/nginx/nginx.conf