Skip to content

Commit

Permalink
fixes for github action
Browse files Browse the repository at this point in the history
  • Loading branch information
DireLines committed Aug 24, 2024
1 parent dd03b8c commit 7322e70
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
11 changes: 6 additions & 5 deletions cmd/project/functions.go
Original file line number Diff line number Diff line change
Expand Up @@ -690,9 +690,10 @@ func buildEndpointConfig(projectFolder string, projectId string) (err error) {
handlerPath := path.Join(remoteProjectPath, config.GetPath([]string{"runtime", "handler_path"}).(string))
pythonCmd := fmt.Sprintf("python -u %s", handlerPath)
projectName := mustGetPathAs[string](config, "name")
endpointName := fmt.Sprintf("%s-endpoint-%s", projectName, projectId)
templateConfig := map[string]any{
"name": fmt.Sprintf("%s-endpoint-%s", projectName, projectId),
"image_name": mustGetPathAs[string](config, "project", "base_image"), //TODO: make it a parameter
"name": endpointName,
"image_name": endpointName,
"env_vars": mustGetPathAs[*toml.Tree](config, "project", "env_vars").ToMap(),
"container_disk_size_gb": mustGetPathAs[int64](config, "project", "container_disk_size_gb"),
"volume_mount_path": mustGetPathAs[string](config, "project", "volume_mount_path"),
Expand Down Expand Up @@ -798,10 +799,10 @@ func buildProjectDockerfile() (err error) {
// base image: from toml
dockerfile = strings.ReplaceAll(dockerfile, "<<BASE_IMAGE>>", mustGetPathAs[string](config, "project", "base_image"))
// pip requirements
dockerfile = strings.ReplaceAll(dockerfile, "<<REQUIREMENTS_PATH>>", mustGetPathAs[string](config, "project", "requirements_path"))
dockerfile = strings.ReplaceAll(dockerfile, "<<PYTHON_VERSION>>", mustGetPathAs[string](config, "project", "python_version"))
dockerfile = strings.ReplaceAll(dockerfile, "<<REQUIREMENTS_PATH>>", mustGetPathAs[string](config, "runtime", "requirements_path"))
dockerfile = strings.ReplaceAll(dockerfile, "<<PYTHON_VERSION>>", mustGetPathAs[string](config, "runtime", "python_version"))
// cmd: start handler
dockerfile = strings.ReplaceAll(dockerfile, "<<HANDLER_PATH>>", mustGetPathAs[string](config, "project", "handler_path"))
dockerfile = strings.ReplaceAll(dockerfile, "<<HANDLER_PATH>>", mustGetPathAs[string](config, "runtime", "handler_path"))
if includeEnvInDockerfile {
dockerEnv := formatAsDockerEnv(createEnvVars(mustGetPathAs[*toml.Tree](config, "project", "env_vars"), mustGetPathAs[string](config, "project", "uuid")))
dockerfile = strings.ReplaceAll(dockerfile, "<<SET_ENV_VARS>>", "\n"+dockerEnv)
Expand Down
2 changes: 1 addition & 1 deletion cmd/project/project.go
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,7 @@ var BuildProjectDockerfileCmd = &cobra.Command{
Run: func(cmd *cobra.Command, args []string) {
err := buildProjectDockerfile()
if err != nil {
log.Fatalf("Error generating endpoint configuration: %v", err)
log.Fatalf("Error generating dockerfile: %v", err)
return
}
},
Expand Down

0 comments on commit 7322e70

Please sign in to comment.