This file contains hidden or 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
# pip install docker-compose |
This file contains hidden or 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
$ docker-compose -f dev-compose.yml up cassandra-primary cassandra |
This file contains hidden or 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
$ docker-compose -f dev-compose.yml up --build tests |
This file contains hidden or 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: | |
mockitout: | |
build: . | |
ports: | |
- "443:8443" | |
command: --debug | |
environment: | |
- "LISTEN_ADDR=0.0.0.0:8443" |
This file contains hidden or 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
#!/bin/bash | |
## Entrypoint script for healthchecks-example. This script is to show how to write an | |
## entrypoint script that actually passes down signals from Docker. | |
## Load our DB Password into a runtime only Environment Variable | |
if [ -f /run/secrets/password ] | |
then | |
echo "Loading DB password from secrets file" | |
DB_PASS=$(cat /run/secrets/password) | |
export DB_PASS |
This file contains hidden or 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
#!/bin/bash | |
## Entrypoint script for healthchecks-example. This script is to show how to write | |
## an entrypoint script that actually passes down signals from Docker. | |
## Load our DB Password into a runtime only Environment Variable | |
if [ -f /run/secrets/password ] | |
then | |
echo "Loading DB password from secrets file" | |
DB_PASS=$(cat /run/secrets/password) | |
export DB_PASS |
This file contains hidden or 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
FROM golang:latest | |
ADD . /go/src/github.com/madflojo/healthchecks-example | |
WORKDIR /go/src/github.com/madflojo/healthchecks-example/cmd/healthchecks-example | |
RUN go install -v . | |
ENTRYPOINT ["../../docker-entrypoint.sh"] |
This file contains hidden or 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
{ | |
"name": "example", | |
"numbers": [ | |
1, 2, 3, 4 | |
], | |
"nested": { | |
"isit": true, | |
"description": "a nested json" | |
} | |
} |
This file contains hidden or 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 main | |
import ( | |
"encoding/json" | |
"fmt" | |
) | |
func main() { | |
// Create a map to parse the JSON | |
var data map[string]interface{} |
This file contains hidden or 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
// Print out one of our JSON values | |
n, ok := data["name"] | |
if !ok { | |
// access it another way | |
n = "default" | |
} | |
fmt.Printf("Name is %s", n.(string)) |