Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prod deploy #2430

Merged
merged 1 commit into from
Jun 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion internal/functions/deploy/deploy.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ func bundleFunction(ctx context.Context, slug, hostImportMapPath string, fsys af
}()

hostFuncDir := filepath.Join(cwd, utils.FunctionsDir)
dockerFuncDir := filepath.ToSlash(hostFuncDir)
dockerFuncDir := utils.ToDockerPath(hostFuncDir)

outputPath := utils.DockerEszipDir + "/output.eszip"
binds := []string{
Expand Down
2 changes: 1 addition & 1 deletion internal/functions/serve/serve.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ func ServeFunctions(ctx context.Context, envFilePath string, noVerifyJWT *bool,
if err != nil {
return errors.Errorf("failed to resolve functions dir: %w", err)
}
dockerFuncDir := filepath.ToSlash(hostFuncDir)
dockerFuncDir := utils.ToDockerPath(hostFuncDir)
env = append(env,
fmt.Sprintf("SUPABASE_URL=http://%s:8000", utils.KongAliases[0]),
"SUPABASE_ANON_KEY="+utils.Config.Auth.AnonKey,
Expand Down
12 changes: 9 additions & 3 deletions internal/utils/deno.go
Original file line number Diff line number Diff line change
Expand Up @@ -268,15 +268,15 @@ func (m *ImportMap) BindHostModules() []string {
if !filepath.IsAbs(hostPath) || strings.HasPrefix(hostPath, hostFuncDir) {
continue
}
dockerPath := filepath.ToSlash(hostPath)
dockerPath := ToDockerPath(hostPath)
binds = append(binds, hostPath+":"+dockerPath+":ro")
}
for _, mapping := range m.Scopes {
for _, hostPath := range mapping {
if !filepath.IsAbs(hostPath) || strings.HasPrefix(hostPath, hostFuncDir) {
continue
}
dockerPath := filepath.ToSlash(hostPath)
dockerPath := ToDockerPath(hostPath)
binds = append(binds, hostPath+":"+dockerPath+":ro")
}
}
Expand Down Expand Up @@ -329,7 +329,7 @@ func BindImportMap(importMapPath string, fsys afero.Fs) ([]string, string, error
if err != nil {
return nil, "", errors.Errorf("failed to resolve host import map: %w", err)
}
dockerImportMapPath := filepath.ToSlash(hostImportMapPath)
dockerImportMapPath := ToDockerPath(hostImportMapPath)
importMap, err := NewImportMap(hostImportMapPath, fsys)
if err != nil {
return nil, "", err
Expand All @@ -340,3 +340,9 @@ func BindImportMap(importMapPath string, fsys afero.Fs) ([]string, string, error
}
return binds, dockerImportMapPath, nil
}

func ToDockerPath(absHostPath string) string {
prefix := filepath.VolumeName(absHostPath)
dockerPath := filepath.ToSlash(absHostPath)
return strings.TrimPrefix(dockerPath, prefix)
}