From 4a0d07dc42966b4daa1fbc782f232996087fe658 Mon Sep 17 00:00:00 2001 From: Stefan Scherer Date: Wed, 23 Nov 2016 23:11:06 +0100 Subject: [PATCH] Create nanoserver variant Signed-off-by: Stefan Scherer --- .gitignore | 1 + Dockerfile | 10 +++------- Dockerfile.build | 6 ++++++ README.md | 9 ++++----- build.sh | 8 ++++++++ 5 files changed, 22 insertions(+), 12 deletions(-) create mode 100644 Dockerfile.build create mode 100755 build.sh 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 .