File tree Expand file tree Collapse file tree 1 file changed +12
-1
lines changed Expand file tree Collapse file tree 1 file changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -10,6 +10,7 @@ import (
10
10
"os/exec"
11
11
slashpath "path"
12
12
"path/filepath"
13
+ "regexp"
13
14
14
15
v1 "github.com/google/go-containerregistry/pkg/v1"
15
16
"github.com/google/go-containerregistry/pkg/v1/tarball"
@@ -23,7 +24,17 @@ func (b pythonBuilder) Base(customBase string) string {
23
24
if customBase != "" {
24
25
return customBase
25
26
}
26
- return defaultPythonBase
27
+ cmd := exec .Command ("python" , "-V" )
28
+ out , err := cmd .CombinedOutput ()
29
+ if err != nil {
30
+ return defaultPythonBase
31
+ }
32
+ re := regexp .MustCompile (`Python (\d+\.\d+)\.\d+` )
33
+ subMatches := re .FindSubmatch (out )
34
+ if len (subMatches ) != 2 {
35
+ return defaultPythonBase
36
+ }
37
+ return fmt .Sprintf ("python:%s-slim" , subMatches [1 ])
27
38
}
28
39
29
40
// Configure gives the python builder a chance to mutate the final
You can’t perform that action at this time.
0 commit comments