MCPcopy
hub / github.com/iron-io/functions / PreBuild

Method PreBuild

fn/langs/java.go:22–40  ·  view source on GitHub ↗

PreBuild for Go builds the binary so the final image can be as small as possible

()

Source from the content-addressed store, hash-verified

20
21// PreBuild for Go builds the binary so the final image can be as small as possible
22func (lh *JavaLangHelper) PreBuild() error {
23 wd, err := os.Getwd()
24 if err != nil {
25 return err
26 }
27
28 cmd := exec.Command(
29 "docker", "run",
30 "--rm", "-v",
31 wd+":/java", "-w", "/java", "iron/java:dev",
32 "/bin/sh", "-c", "javac -cp lib/*:. *.java",
33 )
34 cmd.Stderr = os.Stderr
35 cmd.Stdout = os.Stdout
36 if err := cmd.Run(); err != nil {
37 return fmt.Errorf("error running docker build: %v", err)
38 }
39 return nil
40}
41
42func (lh *JavaLangHelper) AfterBuild() error {
43 return nil

Callers

nothing calls this directly

Calls 2

CommandMethod · 0.80
RunMethod · 0.80

Tested by

no test coverage detected