diff --git a/README.md b/README.md index e0d7a16..8ca09b7 100644 --- a/README.md +++ b/README.md @@ -1,52 +1,16 @@ **kontain.me** serves Docker container images generated on-demand at the time they are requested. -# `random.kontain.me` +These include: -`docker pull random.kontain.me/random:latest` serves an image containing random -data. By default the image contains one layer containing 10 MB of random bytes. -You can request a specific size and shape of random image. For example, -`random.kontain.me/random:4x100` generates a random image of 4 layers of 100 -random bytes each. - -# `mirror.kontain.me` - -`docker pull mirror.kontain.me/[image]` will pull the an image (if it can) and -cache the manifest and layers. Subsequent pulls will, if possible, serve from -the cache. - -This acts as a simple [registry -mirror](https://docs.docker.com/registry/recipes/mirror/) which can reduce the -number of pulls from the original registry, in case they impose request limits -or exorbitant bandwidth costs or latencies. - -# `flatten.kontain.me` - -`docker pull flatten.kontain.me/[image]` will pull an image (if it can), then -flatten its layers into a single layer.

- -_Flattening images obviates image layer caching, so it's often not an -optimization._ - -# `ko.kontain.me` - -`docker pull ko.kontain.me/ko/[import path]` serves an image -containing a Go binary fetched using `go get` and built into a -container image using [ko](https://github.com/google/ko). - -For example, `docker pull ko.kontain.me/ko/github.com/google/ko/cmd/ko` will -fetch, build and (eventually) serve a Docker image containing `ko` itself. -_Koception!_ - -# `buildpack.kontain.me` - -`docker pull buildpack.kontain.me/[ghuser]/[ghrepo]:[revision]` serves an image -fetched from source on GitHub and built using [CNCF -Buildpacks](https://buildpacks.io) - -For example, `docker pull -buildpack.kontain.me/buildpack/sample-java-app:b032838` fetches, builds and -serves a [sample Java app](https://github.com/buildpack/sample-java-app). +* [`random.kontain.me`](./cmd/random), which serves randomly-generated images. +* [`mirror.kontain.me`](./cmd/mirror), which pulls and caches images from other registries. +* [`flatten.kontain.me`](./cmd/flatten), which pulls and flattens images from other registries, + so they contain only one layer. +* [`ko.kontain.me`](./cmd/ko), which builds a Go binary into a container image using + [`ko`](https://github.com/google/ko). +* [`buildpack.kontain.me`](./cmd/buildpack), which builds a GitHub repo using [CNCF + Buildpacks](https://buildpacks.io). # Caveats diff --git a/cmd/app/kodata/favicon.ico b/cmd/app/kodata/favicon.ico deleted file mode 100644 index 0c34bfd..0000000 Binary files a/cmd/app/kodata/favicon.ico and /dev/null differ diff --git a/cmd/app/kodata/index.html b/cmd/app/kodata/index.html deleted file mode 100644 index ae3f54e..0000000 --- a/cmd/app/kodata/index.html +++ /dev/null @@ -1,85 +0,0 @@ - - - -Kontain.me - - - -

kontain.me serves Docker container images generated on-demand at the -time they are requested.

- -

random.kontain.me

- -

docker pull random.kontain.me/random:latest serves an image containing -random data. By default the image contains one layer containing 10 MB of random -bytes. You can request a specific size and shape of random image. For example, -random.kontain.me/random:4x100 generates a random image of 4 layers of -100 random bytes each. - -

mirror.kontain.me

- -

docker pull mirror.kontain.me/[image] will pull the an image -(if it can) and cache the manifest and layers. Subsequent pulls will, if -possible, serve from the cache.

- -

This acts as a simple registry - mirror which can reduce the number of pulls from the original -registry, in case they impose request limits or exorbitant bandwidth costs or -latencies.

- -

flatten.kontain.me

- -

docker pull flatten.kontain.me/[image] will pull an image (if -it can), then flatten its layers into a single layer.

- -

Flattening images obviates image layer caching, so it's often not an - optimization.

- -

ko.kontain.me

- -

docker pull ko.kontain.me/[import path] serves an image -containing a Go binary fetched using go get and built into a -container image using ko.

- -

For example, -docker pull ko.kontain.me/github.com/google/ko/cmd/ko will fetch, -build and (eventually) serve a Docker image containing ko itself. -Koception!

- -

NB: All Docker image references must be lowercase.

- -

buildpack.kontain.me

- -

docker pull buildpack.kontain.me/[ghuser]/[ghrepo]/[path/to/app]:[revision] -serves an image fetched from source on GitHub and built using CNCF Buildpacks. Specifically, it uses the GCP buildpack - builder

- -

For example, docker pull - buildpack.kontain.me/googlecloudplatform/buildpack-samples/sample-go:master - fetches, builds and serves a sample - Go app.

- -

NB: All Docker image references must be lowercase.

- -

The image tag can be a commit, branch or tag. The default, -:latest, pulls the master branch.

- -

Caveats

- -

The registry does not accept pushes of any kind. This is a silly hack and if -it's at all reliable it's by accident. Don't rely on it for anything serious. -It could probably do a lot of smart things to be a lot faster.

- -

Source is available on -GitHub.

- - diff --git a/cmd/app/main.go b/cmd/app/main.go deleted file mode 100644 index 738b8c6..0000000 --- a/cmd/app/main.go +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright 2018 Google LLC All Rights Reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package main - -import ( - "fmt" - "log" - "net/http" - "os" -) - -func main() { - http.Handle("/", http.FileServer(http.Dir("/var/run/ko"))) - log.Println("Starting...") - port := os.Getenv("PORT") - if port == "" { - port = "8080" - log.Printf("Defaulting to port %s", port) - } - log.Printf("Listening on port %s", port) - log.Fatal(http.ListenAndServe(fmt.Sprintf(":%s", port), nil)) -} diff --git a/cmd/buildpack/main.go b/cmd/buildpack/main.go index 72fa996..4f8cb57 100644 --- a/cmd/buildpack/main.go +++ b/cmd/buildpack/main.go @@ -54,7 +54,7 @@ func main() { error: log.New(os.Stderr, "E ", log.Ldate|log.Ltime|log.Lshortfile), ds: ds, }) - http.Handle("/", http.RedirectHandler("https://kontain.me", http.StatusMovedPermanently)) + http.Handle("/", http.RedirectHandler("https://github.com/imjasonh/kontain.me/blob/master/cmd/buildpack", http.StatusSeeOther)) log.Println("Starting...") port := os.Getenv("PORT") diff --git a/cmd/flatten/main.go b/cmd/flatten/main.go index f7db5ed..1b8f6c4 100644 --- a/cmd/flatten/main.go +++ b/cmd/flatten/main.go @@ -37,7 +37,7 @@ func main() { info: log.New(os.Stdout, "I ", log.Ldate|log.Ltime|log.Lshortfile), error: log.New(os.Stderr, "E ", log.Ldate|log.Ltime|log.Lshortfile), }) - http.Handle("/", http.RedirectHandler("https://kontain.me", http.StatusMovedPermanently)) + http.Handle("/", http.RedirectHandler("https://github.com/imjasonh/kontain.me/blob/master/cmd/flatten", http.StatusSeeOther)) log.Println("Starting...") port := os.Getenv("PORT") diff --git a/cmd/ko/main.go b/cmd/ko/main.go index 190083d..b76cefc 100644 --- a/cmd/ko/main.go +++ b/cmd/ko/main.go @@ -41,7 +41,7 @@ func main() { info: log.New(os.Stdout, "I ", log.Ldate|log.Ltime|log.Lshortfile), error: log.New(os.Stderr, "E ", log.Ldate|log.Ltime|log.Lshortfile), }) - http.Handle("/", http.RedirectHandler("https://kontain.me", http.StatusMovedPermanently)) + http.Handle("/", http.RedirectHandler("https://github.com/imjasonh/kontain.me/blob/master/cmd/ko", http.StatusSeeOther)) log.Println("Starting...") port := os.Getenv("PORT") diff --git a/cmd/mirror/main.go b/cmd/mirror/main.go index bc54950..c1ebafc 100644 --- a/cmd/mirror/main.go +++ b/cmd/mirror/main.go @@ -32,7 +32,7 @@ func main() { info: log.New(os.Stdout, "I ", log.Ldate|log.Ltime|log.Lshortfile), error: log.New(os.Stderr, "E ", log.Ldate|log.Ltime|log.Lshortfile), }) - http.Handle("/", http.RedirectHandler("https://kontain.me", http.StatusMovedPermanently)) + http.Handle("/", http.RedirectHandler("https://github.com/imjasonh/kontain.me/blob/master/cmd/mirror", http.StatusSeeOther)) log.Println("Starting...") port := os.Getenv("PORT") diff --git a/cmd/random/main.go b/cmd/random/main.go index 65521b5..d18daf8 100644 --- a/cmd/random/main.go +++ b/cmd/random/main.go @@ -18,7 +18,7 @@ func main() { info: log.New(os.Stdout, "I ", log.Ldate|log.Ltime|log.Lshortfile), error: log.New(os.Stderr, "E ", log.Ldate|log.Ltime|log.Lshortfile), }) - http.Handle("/", http.RedirectHandler("https://kontain.me", http.StatusMovedPermanently)) + http.Handle("/", http.RedirectHandler("https://github.com/imjasonh/kontain.me/blob/master/cmd/random", http.StatusSeeOther)) log.Println("Starting...") port := os.Getenv("PORT")