Created
December 25, 2015 17:47
-
-
Save flovilmart/d507e13c67b988ea875f to your computer and use it in GitHub Desktop.
Parse Anywhere docker container
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/sh | |
# the google app engine project-id | |
PROJECT_ID=FILL_ME | |
# builds the docker image from there | |
docker -D -l debug build -t gcr.io/${PROJECT_ID}/parse-anywhere . | |
# push to google registry | |
gcloud docker push gcr.io/${PROJECT_ID}/parse-anywhere |
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
# Dockerfile extending the google appengine Node image with application files for a | |
# single application. | |
FROM gcr.io/google_appengine/nodejs | |
# Check to see if the the version included in the base runtime satisfies \ | |
# ~0.12.0, if not then do an npm install of the latest available \ | |
# version that satisfies it. \ | |
RUN npm install https://storage.googleapis.com/gae_node_packages/semver.tar.gz && \ | |
(node -e 'var semver = require("semver"); \ | |
if (!semver.satisfies(process.version, "~0.12.0")) \ | |
process.exit(1);' || \ | |
(version=$(curl -L https://storage.googleapis.com/gae_node_packages/node_versions | \ | |
node -e ' \ | |
var semver = require("semver"); \ | |
var http = require("http"); \ | |
var spec = process.argv[1]; \ | |
var latest = ""; \ | |
var versions = ""; \ | |
var selected_version; \ | |
\ | |
function verifyBinary(version) { \ | |
var options = { \ | |
"host": "storage.googleapis.com", \ | |
"method": "HEAD", \ | |
"path": "/gae_node_packages/node-" + version + \ | |
"-linux-x64.tar.gz" \ | |
}; \ | |
var req = http.request(options, function (res) { \ | |
if (res.statusCode == 404) { \ | |
console.error("Binaries for Node satisfying version " + \ | |
version + " are not available."); \ | |
process.exit(1); \ | |
} \ | |
}); \ | |
req.end(); \ | |
} \ | |
function satisfies(version) { \ | |
if (semver.satisfies(version, spec)) { \ | |
process.stdout.write(version); \ | |
verifyBinary(version); \ | |
return true; \ | |
} \ | |
} \ | |
process.stdin.on("data", function(data) { \ | |
versions += data; \ | |
}); \ | |
process.stdin.on("end", function() { \ | |
versions = \ | |
versions.split("\n").sort().reverse(); \ | |
if (!versions.some(satisfies)) { \ | |
console.error("No version of Node found satisfying: " + \ | |
spec); \ | |
process.exit(1); \ | |
} \ | |
});' \ | |
"~0.12.0") && \ | |
rm -rf /nodejs/* && \ | |
(curl https://storage.googleapis.com/gae_node_packages/node-$version-linux-x64.tar.gz | \ | |
tar xzf - -C /nodejs --strip-components=1 \ | |
) \ | |
) \ | |
) | |
# install imagemagick and graphicsmagick | |
RUN apt-get update | |
RUN apt-get install imagemagick graphicsmagick -y | |
# install parse-anywhere globally | |
RUN npm install parse-anywhere -g |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment