Skip to content

Instantly share code, notes, and snippets.

@jthegedus
Created May 14, 2019 23:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jthegedus/b006fbf1fb970fb277c72d638fa6079e to your computer and use it in GitHub Desktop.
Save jthegedus/b006fbf1fb970fb277c72d638fa6079e to your computer and use it in GitHub Desktop.
Berglas w Node.js
FROM node:10-alpine
RUN apk add ca-certificates
ENV NODE_ENV=production
WORKDIR /urs/src/app
COPY package.json yarn.lock ./
RUN yarn install --production
COPY . ./
COPY --from=gcr.io/berglas/berglas:latest /bin/berglas /bin/berglas
ENTRYPOINT exec /bin/berglas exec -- yarn start
{
"name": "src",
"version": "0.0.12",
"main": "src/function.js",
"license": "MIT",
"scripts": {
"start": "functions-framework --target=helloBerglas"
},
"dependencies": {
"@google-cloud/functions-framework": "^1.1.0"
}
}
exports.helloBerglas = (req, res) => {
let data = '<h1>Berglas Test</h1>';
data += `<p>nsecret is ${process.env.API_KEY}</p>`;
data += `<p>listening on port ${process.env.PORT}</p>`;
res.send(data);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment