Created
October 6, 2016 10:12
-
-
Save stephenmelrose/aa26424c38d8d15fc408957c4b14cd5f to your computer and use it in GitHub Desktop.
Docker nginx ENV Example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
nginx: | |
image: <SNIP> | |
container_name: myapp-nginx | |
environment: | |
MY_HOSTNAME: "myhostname" | |
links: | |
- php | |
ports: | |
- "8000:80" | |
- "8001:81" | |
volumes: | |
- "./:/var/app" | |
- "./logs/nginx:/var/log/nginx" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# ... | |
# Set default run command | |
ADD start.sh /opt/start.sh | |
CMD ["/bin/bash", "/opt/start.sh"] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Replace hostname in config | |
sed -i "s#localhost#${MY_HOSTNAME}#" /etc/nginx/sites-available/default | |
# Start nginx | |
/usr/sbin/nginx |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment