From 0f30176f82bc9984e7a75f96205f86dc3758e2e8 Mon Sep 17 00:00:00 2001 From: Tianon Gravi Date: Thu, 17 Nov 2016 14:28:28 -0800 Subject: [PATCH] Add "nanoserver" variants using "hello.txt" + powershell --- .dockerignore | 1 + .travis.yml | 2 +- Dockerfile.build | 8 ++++---- Makefile | 2 ++ generate-stackbrew-library.sh | 13 ++++++++++++- hello-seattle/nanoserver/Dockerfile | 3 +++ hello-seattle/nanoserver/hello.txt | 21 +++++++++++++++++++++ hello-world/nanoserver/Dockerfile | 3 +++ hello-world/nanoserver/hello.txt | 21 +++++++++++++++++++++ hola-mundo/nanoserver/Dockerfile | 3 +++ hola-mundo/nanoserver/hello.txt | 21 +++++++++++++++++++++ update.sh | 5 +++-- 12 files changed, 95 insertions(+), 8 deletions(-) create mode 100644 hello-seattle/nanoserver/Dockerfile create mode 100644 hello-seattle/nanoserver/hello.txt create mode 100644 hello-world/nanoserver/Dockerfile create mode 100644 hello-world/nanoserver/hello.txt create mode 100644 hola-mundo/nanoserver/Dockerfile create mode 100644 hola-mundo/nanoserver/hello.txt diff --git a/.dockerignore b/.dockerignore index 0de15dc..1e02921 100644 --- a/.dockerignore +++ b/.dockerignore @@ -1,6 +1,7 @@ *.md *.sh */hello +*/nanoserver/hello.txt .dockerignore .git Dockerfile* diff --git a/.travis.yml b/.travis.yml index 2c7212e..b86f06a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -10,7 +10,7 @@ before_script: script: - ./update.sh - - test -z "$(git status --porcelain '*/hello')" + - test -z "$(git status --porcelain '*/hello' '*/nanoserver/hello.txt')" - docker build -t "$image" hello-world - ~/official-images/test/run.sh "$image" diff --git a/Dockerfile.build b/Dockerfile.build index ed3de7c..91302d9 100644 --- a/Dockerfile.build +++ b/Dockerfile.build @@ -1,5 +1,5 @@ # explicitly use Debian for maximum cross-architecture compatibility -FROM debian:jessie +FROM debian:jessie-slim RUN apt-get update && apt-get install -y --no-install-recommends \ gcc \ @@ -10,8 +10,8 @@ RUN apt-get update && apt-get install -y --no-install-recommends \ WORKDIR /usr/src/hello COPY . . -RUN set -x \ - && make clean all test \ - && ls -l */hello +RUN set -ex; \ + make clean all test; \ + find \( -name 'hello' -or -name 'hello.txt' \) -exec ls -l '{}' + CMD ["./hello-world/hello"] diff --git a/Makefile b/Makefile index d0b0b63..480b318 100644 --- a/Makefile +++ b/Makefile @@ -9,6 +9,8 @@ all: $(C_TARGETS) $(C_TARGETS): hello.c $(CC) $(CFLAGS) -o '$@' -D DOCKER_IMAGE='"$(@D)"' -D DOCKER_GREETING="\"$$(cat '$(@D)/greeting.txt')\"" '$<' strip -R .comment -s '$@' + @mkdir -p '$(@D)/nanoserver' + '$@' | sed -e 's/an Ubuntu container/a Nano Server container/g' -e 's!ubuntu bash!microsoft/nanoserver powershell!g' > '$(@D)/nanoserver/hello.txt' .PHONY: clean clean: diff --git a/generate-stackbrew-library.sh b/generate-stackbrew-library.sh index 534c450..71a78a5 100755 --- a/generate-stackbrew-library.sh +++ b/generate-stackbrew-library.sh @@ -34,7 +34,6 @@ cat <<-EOH Maintainers: Tianon Gravi (@tianon), Joseph Ferguson (@yosifkit) GitRepo: https://github.com/docker-library/hello-world.git -Directory: $image EOH commit="$(dirCommit "$image")" @@ -43,4 +42,16 @@ echo cat <<-EOE Tags: latest GitCommit: $commit + Directory: $image EOE + +if [ -d "$image/nanoserver" ]; then + commit="$(dirCommit "$image/nanoserver")" + + echo + cat <<-EOE + Tags: nanoserver + GitCommit: $commit + Directory: $image/nanoserver + EOE +fi diff --git a/hello-seattle/nanoserver/Dockerfile b/hello-seattle/nanoserver/Dockerfile new file mode 100644 index 0000000..6866cbb --- /dev/null +++ b/hello-seattle/nanoserver/Dockerfile @@ -0,0 +1,3 @@ +FROM microsoft/nanoserver +COPY hello.txt C: +CMD ["cmd", "/C", "type C:\\hello.txt"] diff --git a/hello-seattle/nanoserver/hello.txt b/hello-seattle/nanoserver/hello.txt new file mode 100644 index 0000000..1b0453a --- /dev/null +++ b/hello-seattle/nanoserver/hello.txt @@ -0,0 +1,21 @@ + +Hello from DockerCon 2016 (Seattle)! +This message shows that your installation appears to be working correctly. + +To generate this message, Docker took the following steps: + 1. The Docker client contacted the Docker daemon. + 2. The Docker daemon pulled the "hello-seattle" image from the Docker Hub. + 3. The Docker daemon created a new container from that image which runs the + executable that produces the output you are currently reading. + 4. The Docker daemon streamed that output to the Docker client, which sent it + to your terminal. + +To try something more ambitious, you can run a Nano Server container with: + $ docker run -it microsoft/nanoserver powershell + +Share images, automate workflows, and more with a free Docker Hub account: + https://hub.docker.com + +For more examples and ideas, visit: + https://docs.docker.com/engine/userguide/ + diff --git a/hello-world/nanoserver/Dockerfile b/hello-world/nanoserver/Dockerfile new file mode 100644 index 0000000..6866cbb --- /dev/null +++ b/hello-world/nanoserver/Dockerfile @@ -0,0 +1,3 @@ +FROM microsoft/nanoserver +COPY hello.txt C: +CMD ["cmd", "/C", "type C:\\hello.txt"] diff --git a/hello-world/nanoserver/hello.txt b/hello-world/nanoserver/hello.txt new file mode 100644 index 0000000..98a985d --- /dev/null +++ b/hello-world/nanoserver/hello.txt @@ -0,0 +1,21 @@ + +Hello from Docker! +This message shows that your installation appears to be working correctly. + +To generate this message, Docker took the following steps: + 1. The Docker client contacted the Docker daemon. + 2. The Docker daemon pulled the "hello-world" image from the Docker Hub. + 3. The Docker daemon created a new container from that image which runs the + executable that produces the output you are currently reading. + 4. The Docker daemon streamed that output to the Docker client, which sent it + to your terminal. + +To try something more ambitious, you can run a Nano Server container with: + $ docker run -it microsoft/nanoserver powershell + +Share images, automate workflows, and more with a free Docker Hub account: + https://hub.docker.com + +For more examples and ideas, visit: + https://docs.docker.com/engine/userguide/ + diff --git a/hola-mundo/nanoserver/Dockerfile b/hola-mundo/nanoserver/Dockerfile new file mode 100644 index 0000000..6866cbb --- /dev/null +++ b/hola-mundo/nanoserver/Dockerfile @@ -0,0 +1,3 @@ +FROM microsoft/nanoserver +COPY hello.txt C: +CMD ["cmd", "/C", "type C:\\hello.txt"] diff --git a/hola-mundo/nanoserver/hello.txt b/hola-mundo/nanoserver/hello.txt new file mode 100644 index 0000000..586920a --- /dev/null +++ b/hola-mundo/nanoserver/hello.txt @@ -0,0 +1,21 @@ + +¡Hola de DockerCon EU 2015 (Barcelona)! +This message shows that your installation appears to be working correctly. + +To generate this message, Docker took the following steps: + 1. The Docker client contacted the Docker daemon. + 2. The Docker daemon pulled the "hola-mundo" image from the Docker Hub. + 3. The Docker daemon created a new container from that image which runs the + executable that produces the output you are currently reading. + 4. The Docker daemon streamed that output to the Docker client, which sent it + to your terminal. + +To try something more ambitious, you can run a Nano Server container with: + $ docker run -it microsoft/nanoserver powershell + +Share images, automate workflows, and more with a free Docker Hub account: + https://hub.docker.com + +For more examples and ideas, visit: + https://docs.docker.com/engine/userguide/ + diff --git a/update.sh b/update.sh index 040b325..2acb8eb 100755 --- a/update.sh +++ b/update.sh @@ -7,8 +7,8 @@ set -x docker build -f Dockerfile.build -t hello-world:build . -rm -rf */hello -docker run --rm hello-world:build sh -c 'tar --create */hello' | tar --extract --wildcards '*/hello' +rm -rf */hello */nanoserver/hello.txt +docker run --rm hello-world:build sh -c 'find \( -name hello -or -name hello.txt \) -print0 | xargs -0 tar --create' | tar --extract --verbose for h in */hello; do d="$(dirname "$h")" @@ -16,3 +16,4 @@ for h in */hello; do docker build -t hello-world:"test-$d" "$d" docker run --rm hello-world:"test-$d" done +ls -l */nanoserver/hello.txt || :