-
Notifications
You must be signed in to change notification settings - Fork 421
Add new -overlay option to overlay files prior to templatizing #31
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
markriggins
wants to merge
1
commit into
jwilder:master
Choose a base branch
from
markriggins:master
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
*.gz |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,31 @@ | ||
FROM ubuntu:14.04 | ||
FROM nginx:1.9 | ||
MAINTAINER Jason Wilder [email protected] | ||
|
||
# Install Nginx. | ||
RUN echo "deb http://ppa.launchpad.net/nginx/stable/ubuntu trusty main" > /etc/apt/sources.list.d/nginx-stable-trusty.list | ||
RUN echo "deb-src http://ppa.launchpad.net/nginx/stable/ubuntu trusty main" >> /etc/apt/sources.list.d/nginx-stable-trusty.list | ||
RUN apt-key adv --keyserver keyserver.ubuntu.com --recv-keys C300EE8C | ||
RUN apt-get update | ||
RUN apt-get install -y wget nginx | ||
# RUN wget https://github.com/markriggins/dockerize/releases/download/v0.2.0/dockerize-linux-amd64-v0.0.4.tar.gz | ||
# RUN tar -C /usr/local/bin -xvzf dockerize-linux-amd64-v0.2.0.tar.gz | ||
|
||
RUN wget https://github.com/jwilder/dockerize/releases/download/v0.0.4/dockerize-linux-amd64-v0.0.4.tar.gz | ||
RUN tar -C /usr/local/bin -xvzf dockerize-linux-amd64-v0.0.4.tar.gz | ||
COPY .dockerize_linux_amd64.tar.gz /tmp/ | ||
RUN cd /usr/local/bin && \ | ||
tar -xzv --strip-components=1 -f /tmp/.d*.gz dockerize_linux_amd64/dockerize && \ | ||
rm /tmp/.d*.gz | ||
|
||
RUN echo "daemon off;" >> /etc/nginx/nginx.conf | ||
|
||
ADD default.tmpl /etc/nginx/sites-available/default.tmpl | ||
COPY default.tmpl /etc/nginx/sites-available/default.tmpl | ||
COPY overlays /tmp/overlays | ||
|
||
EXPOSE 80 | ||
|
||
CMD ["dockerize", "-template", "/etc/nginx/sites-available/default.tmpl:/etc/nginx/sites-available/default", "-stdout", "/var/log/nginx/access.log", "-stderr", "/var/log/nginx/error.log", "nginx"] | ||
ENV DEPLOYMENT_ENV=staging | ||
|
||
# These options do not work well on virtualbox osx -- it pegs one CPU | ||
# "-poll", \ | ||
# "-stdout", "/var/log/nginx/access.log", \ | ||
# "-stderr", "/var/log/nginx/error.log", \ | ||
|
||
CMD [ "dockerize", \ | ||
"-template", "/etc/nginx/sites-available/default.tmpl:/etc/nginx/sites-available/default", \ | ||
"-overlay", "/tmp/overlays/_common/html:/usr/share/nginx/", \ | ||
"-overlay", "/tmp/overlays/{{ .Env.DEPLOYMENT_ENV }}/html:/usr/share/nginx/", \ | ||
"-poll", \ | ||
"-stdout", "/var/log/nginx/access.log", \ | ||
"-stderr", "/var/log/nginx/error.log", \ | ||
"--", "nginx", "-g", "daemon off;"] |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
.PHONY : build run-staging run-prod | ||
|
||
build: | ||
cd ../..; goxc -os linux -arch amd64 | ||
cp -f $(shell bash -xc 'find $(GOPATH)/bin -name dockerize_linux_amd64.tar.gz| head -1') .dockerize_linux_amd64.tar.gz | ||
docker build -t dockerized-nginx . | ||
rm .dockerize_linux_amd64.tar.gz | ||
|
||
|
||
run-staging: | ||
docker rm -f dockerized-nginx 2>/dev/null || true | ||
docker run -d -p 80:80 -e DEPLOYMENT_ENV=staging --name dockerized-nginx dockerized-nginx | ||
open http://$(shell docker-machine ip $(shell docker-machine active))/robots.txt | ||
|
||
run-prod: | ||
docker rm -f dockerized-nginx 2>/dev/null || true | ||
docker run -d -p 80:80 -e DEPLOYMENT_ENV=prod --name dockerized-nginx dockerized-nginx | ||
open http://$(shell docker-machine ip $(shell docker-machine active))/robots.txt |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# | ||
# Common robots.txt file | ||
# | ||
User-agent: * | ||
Disallow: / |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# | ||
# Prod robots.txt file | ||
# | ||
User-agent: * | ||
Allow: / |
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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I found this confusing -- I thought it was somehow related to golang.org/x/net/context.Context and the ctx variable. So I renamed it to EnvContext and moved it into templates.go, which is the only place its used