diff --git a/.gitignore b/.gitignore index 8365624..73cc2b2 100644 --- a/.gitignore +++ b/.gitignore @@ -6,6 +6,7 @@ # Folders _obj _test +tmp # Architecture specific extensions/prefixes *.[568vq] diff --git a/Dockerfile b/Dockerfile index 873b991..324933c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,11 +1,7 @@ -FROM ubuntu:14.04 +FROM microsoft/nanoserver -RUN apt-get update && apt-get install -y golang-go -RUN apt-get install bash -ADD . /app -WORKDIR /app -RUN go build -o http +COPY tmp / ENV PORT 8000 EXPOSE 8000 -CMD ["/app/http"] +CMD ["\\http.exe"] diff --git a/Dockerfile.build b/Dockerfile.build new file mode 100644 index 0000000..f54efa8 --- /dev/null +++ b/Dockerfile.build @@ -0,0 +1,6 @@ +FROM golang:nanoserver + +COPY . /code +WORKDIR /code + +RUN go build http.go diff --git a/README.md b/README.md index 799eaf4..2dd3026 100644 --- a/README.md +++ b/README.md @@ -1,10 +1,9 @@ -whoami -====== +# whoami for Windows Simple HTTP docker service that prints it's container ID - $ docker run -d -p 8000:8000 --name whoami -t jwilder/whoami + $ docker run -d -p 8000:8000 --name whoami -t stefanscherer/whoami-windows 736ab83847bb12dddd8b09969433f3a02d64d5b0be48f7a5c59a594e3a6a3541 - - $ curl $(hostname --all-ip-addresses | awk '{print $1}'):8000 + + $ iwr http://$(docker inspect -f '{{ .NetworkSettings.Networks.nat.IPAddress }}' whoami):8000 I'm 736ab83847bb diff --git a/build.sh b/build.sh new file mode 100755 index 0000000..4354729 --- /dev/null +++ b/build.sh @@ -0,0 +1,8 @@ +#!/bin/bash +docker build -t httpbuild -f Dockerfile.build . +docker rm -f httpbuild +docker create --name httpbuild httpbuild +rm -rf tmp +mkdir tmp +docker cp httpbuild:/code/http.exe tmp +docker build -t whoami .