Last active
March 13, 2020 16:20
-
-
Save acondrat/d9f66b9adf1d65b904d9f91eb14aad7e to your computer and use it in GitHub Desktop.
cgroup in go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM golang:alpine AS builder | |
RUN apk update && apk add --no-cache git | |
COPY hello.go hello.go | |
RUN go get -d -v | |
RUN go build -o /go/bin/hello | |
FROM scratch | |
COPY --from=builder /go/bin/hello /go/bin/hello | |
ENTRYPOINT ["/go/bin/hello"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"fmt" | |
"io/ioutil" | |
"log" | |
_ "go.uber.org/automaxprocs" | |
) | |
func main() { | |
files, err := ioutil.ReadDir("/sys/fs/cgroup") | |
if err != nil { | |
log.Fatal(err) | |
} | |
for _, f := range files { | |
fmt.Println(f.Name()) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Seems to work as expected