Skip to content

Commit

Permalink
feat: inject 2 env variables (QOVERY_IS_PRODUCTION and QOVERY_BRANCH_…
Browse files Browse the repository at this point in the history
…NAME) into local running container
  • Loading branch information
evoxmusic committed Dec 19, 2019
1 parent e2df6d8 commit e4f3cca
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions cmd/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ var runCmd = &cobra.Command{

ReloadEnvironment()
image := buildContainer(dockerClient, qYML.Application.DockerfilePath())
runContainer(dockerClient, image, a) // TODO docker file content
runContainer(dockerClient, image, branchName, a)

break
}
Expand Down Expand Up @@ -112,11 +112,16 @@ func buildContainer(client *client.Client, dockerfilePath string) *types.ImageSu
return &image
}

func runContainer(client *client.Client, image *types.ImageSummary, configurationMap map[string]interface{}) {
func runContainer(client *client.Client, image *types.ImageSummary, branchName string, configurationMap map[string]interface{}) {
j, _ := json.Marshal(configurationMap)
configurationMapB64 := base64.StdEncoding.EncodeToString(j)

config := &container.Config{Image: image.ID, Env: []string{fmt.Sprintf("QOVERY_JSON_B64=%s", configurationMapB64)}}
config := &container.Config{Image: image.ID, Env: []string{
fmt.Sprintf("QOVERY_JSON_B64=%s", configurationMapB64),
"QOVERY_IS_PRODUCTION=false",
fmt.Sprintf("QOVERY_BRANCH_NAME=%s", branchName),
}}

hostConfig := &container.HostConfig{}

exposePorts := util.ExposePortsFromCurrentDockerfile()
Expand Down

0 comments on commit e4f3cca

Please sign in to comment.