This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func createBuildContext() (io.Reader, error) { | |
// get current working dir | |
wd, err := os.Getwd() | |
if err != nil { | |
return nil, err | |
} | |
// resolve Dockerfile path | |
path := filepath.join(wd, "Dockerfile") | |
return os.Open(path) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class SignUpRequest { | |
String firstName; | |
String lastName; | |
String pin; | |
List<Identifier> identifiers; | |
} | |
class Identifier { | |
String identifier; | |
String identifierType; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import "github.com/docker/docker/pkg/archive" | |
// createBuildContext archive a dir and return an io.Reader | |
func createBuildContext(path string) (io.Reader, error) { | |
return archive.Tar(path, archive.Uncompressed) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// buildLocalImage build a docker image from the supplied `path` parameter. | |
// The image built is intended to be pushed to a local docker registry. | |
// This function assumes there is a Dockerfile in the dir | |
func buildLocalImage(path string) error { | |
// get current working dir, to resolve the path to Dockerfile | |
wd, err := os.Getwd() | |
if err != nil { | |
return err | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.example.myapplication | |
import android.view.LayoutInflater | |
import android.view.View | |
import android.view.ViewGroup | |
import android.widget.TextView | |
import androidx.recyclerview.widget.RecyclerView | |
import java.lang.IllegalArgumentException | |
import java.lang.IllegalStateException |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
version: "3" | |
services: | |
registry: | |
restart: on-failure | |
image: registry:2 | |
ports: | |
- 5010:5000 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
version: "3" | |
services: | |
registry: | |
restart: on-failure | |
image: registry:2 | |
ports: | |
- 5010:5000 | |
environment: | |
- REGISTRY_STORAGE_FILESYSTEM_ROOTDIRECTORY=/data | |
- REGISTRY_AUTH=token |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import ( | |
"github.com/docker/libtrust" | |
"crypto/tls" | |
"crypto/x509" | |
) | |
type tokenServer struct { | |
privateKey libtrust.PrivateKey | |
pubKey libtrust.PublicKey | |
crt, key string | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
type Option struct { | |
issuer, typ, name, account, service string | |
actions []string // requested actions | |
} | |
type Token struct { | |
Token string `json:"token"` | |
AccessToken string `json:"access_token"` | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func (srv *tokenServer) ServeHTTP(w http.ResponseWriter, r *http.Request) { | |
username, password, ok := r.BasicAuth() | |
if !ok { | |
http.Error(w, "auth credentials not found", http.StatusUnauthorized) | |
return | |
} | |
// compare username and password against your datasets | |
// our example only allows foo:bar | |
if username != "foo" || password != "bar" { | |
http.Error(w, "invalid auth credentials", http.StatusUnauthorized) |