A
Size: a a a
AB
AB
AB
AB
./www/
это относительный путь от текущей workdir, а не main.go, бинарника или чего либо ещеAB
M
M
package mainI set MEDIASOUP_WORKER_BIN=/bin/mediasoup
import (
"bytes"
"log"
"os"
"os/exec"
)
func main() {
MediasoupPath := os.Getenv("MEDIASOUP_WORKER_BIN")
log.Println(MediasoupPath)
// set var to get the output
var out bytes.Buffer
f, err := os.Stat(MediasoupPath)
if err != nil {
log.Println(err)
} else {
log.Println(f.Name(), f.IsDir())
}
command := exec.Command(MediasoupPath)
// set the output to our variable
command.Stdout = &out
command.Stderr = &out
err = command.Run()
if err != nil {
log.Println(err)
}
log.Println(out.String())
}
FROM scratchand run it using
ADD test /test-service
ADD mediasoup-worker /bin/mediasoup
ENTRYPOINT [ "/test-service" ]
docker run --env-file .test.env -t test-service:latestI see file is there using os.stat but os/exec shows error
2021/06/12 02:40:59 /bin/mediasoup
2021/06/12 02:40:59 mediasoup false
2021/06/12 02:40:59 fork/exec /bin/mediasoup: no such file or directory
2021/06/12 02:40:59
AB
M
M
M
AB
CGO_ENABLED=0
M
M
AB
M