diff options
-rw-r--r-- | Dockerfile | 10 | ||||
-rw-r--r-- | Makefile | 22 | ||||
-rw-r--r-- | README.md | 2 | ||||
-rw-r--r-- | index.html | 12 | ||||
-rwxr-xr-x | startup.sh | 1 |
5 files changed, 46 insertions, 1 deletions
diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..f8581c1 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,10 @@ +FROM busybox + +MAINTAINER Cody Hiar <codyfh@gmail.com + +ADD index.html /opt/index.html +ADD startup.sh /opt/startup.sh + +EXPOSE 8000 + +CMD /opt/startup.sh diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..2d5833e --- /dev/null +++ b/Makefile @@ -0,0 +1,22 @@ +.PHONY: build + +CONTAINERNAME=thornycrackers_helloworld +IMAGENAME=thornycrackers/helloworld + +help: + @grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}' + +build: ## Build the image + docker build -t $(IMAGENAME) . + +up: build ## Run the container + docker run -dP --name $(CONTAINERNAME) $(IMAGENAME) + +down: ## Stop the container + docker stop $(CONTAINERNAME) 2> /dev/null || echo 'No container to stop' + +clean: down ## Remove the container + docker rm $(CONTAINERNAME) 2> /dev/null || echo 'No container to remove' + +push: ## Push the container to dockerhub + docker push $(IMAGENAME) @@ -1,2 +1,2 @@ # docker-helloworld -A very simple docker example +A very simple dockerized `nc` webserver for testing docker setups. diff --git a/index.html b/index.html new file mode 100644 index 0000000..2738979 --- /dev/null +++ b/index.html @@ -0,0 +1,12 @@ +HTTP/1.1 200 OK +Content-Type: text/html; charset=UTF-8 +Server: netcat + + + + _ _ _ _ _ + | |__ ___| | | ___ __ _____ _ __| | __| | + | '_ \ / _ \ | |/ _ \ \ \ /\ / / _ \| '__| |/ _` | + | | | | __/ | | (_) | \ V V / (_) | | | | (_| | + |_| |_|\___|_|_|\___/ \_/\_/ \___/|_| |_|\__,_| + diff --git a/startup.sh b/startup.sh new file mode 100755 index 0000000..2230eac --- /dev/null +++ b/startup.sh @@ -0,0 +1 @@ +while true ; do nc -l -p 8000 < /opt/index.html ; done |