1
0
Fork 0
mirror of https://github.com/imjasonh/kontain.me synced 2026-07-21 06:27:06 +00:00

move static host to its own app, ko to its own subdomain

This commit is contained in:
Jason Hall 2019-05-10 11:32:33 -04:00
parent b2caac1d48
commit 8b0643a931
8 changed files with 53 additions and 13 deletions

BIN
cmd/.DS_Store vendored

Binary file not shown.

View file

Before

Width:  |  Height:  |  Size: 4.2 KiB

After

Width:  |  Height:  |  Size: 4.2 KiB

Before After
Before After

View file

@ -20,15 +20,15 @@ bytes. You can request a specific size and shape of random image. For example,
<code>kontain.me/random:4x100</code> generates a random image of 4 layers of
100 random bytes each.
<h1><code>kontain.me</code></h1>
<h1><code>ko.kontain.me</code></h1>
<p><code>docker pull kontain.me/ko/[import path]</code> serves an image
<p><code>docker pull ko.kontain.me/ko/[import path]</code> serves an image
containing a Go binary fetched using <code>go get</code> and built into a
container image using <a
href="https://github.com/google/ko"><code>ko</code></a>.</p>
<p>For example,
<code>docker pull kontain.me/ko/github.com/google/ko/cmd/ko</code> will fetch,
<code>docker pull ko.kontain.me/ko/github.com/google/ko/cmd/ko</code> will fetch,
build and (eventually) serve a Docker image containing <code>ko</code> itself.
<i>Koception!</i></p>

34
cmd/app/main.go Normal file
View file

@ -0,0 +1,34 @@
// 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))
}

View file

@ -49,7 +49,6 @@ func main() {
info: lg.StandardLogger(logging.Info),
error: lg.StandardLogger(logging.Error),
})
http.Handle("/", http.FileServer(http.Dir("/var/run/ko")))
log.Println("Starting...")
port := os.Getenv("PORT")