Last active
September 28, 2019 16:30
-
-
Save k33g/092221a070515c7bb0951868c9851a02 to your computer and use it in GitHub Desktop.
This file contains 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
FROM node:12.7.0-alpine | |
WORKDIR /home/app | |
COPY . . | |
RUN npm install | |
RUN addgroup -S app \ | |
&& adduser app -S -G app | |
RUN chown app:app -R /home/app | |
WORKDIR /home/app | |
HEALTHCHECK --interval=5s CMD [ -e /tmp/.lock ] || exit 1 | |
USER app | |
CMD ["node", "index.js"] |
This file contains 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
const http = require('http') | |
const port = 8080 | |
const fs = require('fs') | |
let index_page = ` | |
<!doctype html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<meta http-equiv="x-ua-compatible" content="ie=edge"> | |
<title>Hello World!</title> | |
<meta name="description" content=""> | |
<meta name="viewport" content="width=device-width, initial-scale=1"> | |
<style> | |
.container { min-height: 100vh; display: flex; justify-content: center; align-items: center; text-align: center; } | |
.title { font-family: "Source Sans Pro", "Helvetica Neue", Arial, sans-serif; display: block; font-weight: 300; font-size: 100px; color: #35495e; letter-spacing: 1px; } | |
</style> | |
</head> | |
<body> | |
<section class="container"> | |
<div> | |
<h1 class="title"> | |
👋 Hello World 🌍 | |
</h1> | |
</div> | |
</section> | |
</body> | |
</html> | |
` | |
const requestHandler = (request, response) => { | |
response.writeHead(200, {'Content-Type': 'text/html; charset=utf-8'}) | |
response.end(index_page) | |
} | |
const server = http.createServer(requestHandler) | |
server.listen(port, (err) => { | |
fs.writeFile("/tmp/.lock", "Service started", (err) => { | |
if(err) { | |
return err | |
} | |
}) | |
}) |
This file contains 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
version: 1.0 | |
provider: | |
name: openfaas | |
gateway: http://openfaas.test:8080 | |
functions: | |
yo-spock: | |
lang: dockerfile | |
handler: ./yo-spock | |
image: k33g/yo-spock:latest |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment