Last active
January 6, 2019 03:05
-
-
Save hayd/5360b3cd855bc7ba0eea0e20a8413c29 to your computer and use it in GitHub Desktop.
deno-docker
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 hayd/deno:alpine-0.2.5 | |
EXPOSE 1993 | |
WORKDIR /app | |
ADD . /app | |
ENTRYPOINT ["deno", "--allow-net", "main.ts"] |
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
import { serve } from "https://deno.land/x/net/http.ts"; | |
const PORT = 1993; | |
const s = serve(`0.0.0.0:${PORT}`); | |
async function main() { | |
console.log(`Server started on port ${PORT}`); | |
for await (const req of s) { | |
req.respond({ body: new TextEncoder().encode("Hello World\n") }); | |
} | |
} | |
main(); |
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
docker build -t app app && docker run -it --init -p 1993:1993 app |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment