Skip to content

Instantly share code, notes, and snippets.

@dmlogv
Created June 19, 2019 07:59
Show Gist options
  • Save dmlogv/b255f67af2a4aff27bad50c137f57fd7 to your computer and use it in GitHub Desktop.
Save dmlogv/b255f67af2a4aff27bad50c137f57fd7 to your computer and use it in GitHub Desktop.
Dockerfile with the one-line nc-based webserver
FROM busybox:latest
ENV port=8081
RUN \
echo -e 'echo $port\n\nwhile true\ndo\n (echo -e "HTTP/1.1 200 OK\\nContent-Type: text/html\\n\\n<b>Hello World</b><br>Builded at $(date)";) | nc -vv -l -p $port\ndone' > server.sh \
&& chmod +x server.sh \
&& mkdir /var/log
EXPOSE 8081:8081
ENTRYPOINT port=$port ./server.sh
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment