Skip to content

Instantly share code, notes, and snippets.

@hayd
Last active January 6, 2019 03:05
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 hayd/5360b3cd855bc7ba0eea0e20a8413c29 to your computer and use it in GitHub Desktop.
Save hayd/5360b3cd855bc7ba0eea0e20a8413c29 to your computer and use it in GitHub Desktop.
deno-docker
FROM hayd/deno:alpine-0.2.5
EXPOSE 1993
WORKDIR /app
ADD . /app
ENTRYPOINT ["deno", "--allow-net", "main.ts"]
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();
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