Skip to content

Instantly share code, notes, and snippets.

@mattgrill
Last active August 29, 2015 13:57
Show Gist options
  • Save mattgrill/9920798 to your computer and use it in GitHub Desktop.
Save mattgrill/9920798 to your computer and use it in GitHub Desktop.
#!/bin/bash
set -e
CONTAINERID=$(sudo docker run -d -p 80 drpal/$project_name:$BUILD_NUMBER)
CONTAINER_HOST_PORT=$(sudo docker port $CONTAINERID 80)
cat > $BUILD_NUMBER-$project_name/$project_name.localhost << EOL
upstream $project_name.localhost {
server $CONTAINER_HOST_PORT;
}
server {
gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript;
server_name $project_name.localhost;
location / {
proxy_pass http://$project_name.localhost;
include /etc/nginx/proxy_params;
}
}
EOL
sudo cp $WORKSPACE/$BUILD_NUMBER-$project_name/$project_name.localhost /etc/nginx/sites-enabled/$project_name.localhost
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment