Codebase list gosu / ed22021
Merge tag 'upstream/1.7' Upstream version 1.7 * tag 'upstream/1.7': Imported Upstream version 1.7 Tianon Gravi 8 years ago
3 changed file(s) with 22 addition(s) and 19 deletion(s). Raw diff Collapse all Expand all
00 FROM golang:1.5
11
2 RUN mkdir -p /go/src/github.com/docker \
3 && git clone https://github.com/docker/libcontainer.git /go/src/github.com/docker/libcontainer \
4 && cd /go/src/github.com/docker/libcontainer \
5 && git checkout --quiet b322073f27b0e9e60b2ab07eff7f4e96a24cb3f9
2 RUN mkdir -p /go/src/github.com/opencontainers \
3 && git clone -b v0.0.4 https://github.com/opencontainers/runc.git /go/src/github.com/opencontainers/runc
64
7 ENV GOPATH $GOPATH:/go/src/github.com/docker/libcontainer/vendor
5 ENV GOPATH $GOPATH:/go/src/github.com/opencontainers/runc/Godeps/_workspace
86
97 # disable CGO for ALL THE THINGS (to help ensure no libc)
108 ENV CGO_ENABLED 0
9
10 ENV BUILD_FLAGS -v -ldflags -d
1111
1212 COPY *.go /go/src/github.com/tianon/gosu/
1313 WORKDIR /go/src/github.com/tianon/gosu
1414
1515 # gosu-$(dpkg --print-architecture)
16 RUN GOARCH=amd64 go build -v -ldflags -d -o /go/bin/gosu-amd64 \
16 RUN GOARCH=amd64 go build $BUILD_FLAGS -o /go/bin/gosu-amd64 \
1717 && /go/bin/gosu-amd64 www-data id \
1818 && /go/bin/gosu-amd64 www-data ls -l /proc/self/fd
19 RUN GOARCH=386 go build -v -ldflags -d -o /go/bin/gosu-i386 \
19 RUN GOARCH=386 go build $BUILD_FLAGS -o /go/bin/gosu-i386 \
2020 && /go/bin/gosu-i386 www-data id \
2121 && /go/bin/gosu-i386 www-data ls -l /proc/self/fd
22 RUN GOARCH=arm GOARM=5 go build -v -ldflags -d -o /go/bin/gosu-armel
23 RUN GOARCH=arm GOARM=6 go build -v -ldflags -d -o /go/bin/gosu-armhf
24 #RUN GOARCH=arm GOARM=7 go build -v -ldflags -d -o /go/bin/gosu-armhf # boo Raspberry Pi, making life hard
22 RUN GOARCH=arm GOARM=5 go build $BUILD_FLAGS -o /go/bin/gosu-armel
23 RUN GOARCH=arm GOARM=6 go build $BUILD_FLAGS -o /go/bin/gosu-armhf
24 #RUN GOARCH=arm GOARM=7 go build $BUILD_FLAGS -o /go/bin/gosu-armhf # boo Raspberry Pi, making life hard
25 RUN GOARCH=arm64 go build $BUILD_FLAGS -o /go/bin/gosu-arm64
26 RUN GOARCH=ppc64 go build $BUILD_FLAGS -o /go/bin/gosu-ppc64
27 RUN GOARCH=ppc64le go build $BUILD_FLAGS -o /go/bin/gosu-ppc64el
00 package main
11
22 import (
3 "fmt"
43 "os"
54 "syscall"
65
7 "github.com/docker/libcontainer/system"
8 "github.com/docker/libcontainer/user"
6 "github.com/opencontainers/runc/libcontainer/system"
7 "github.com/opencontainers/runc/libcontainer/user"
98 )
109
1110 // this function comes from libcontainer/init_linux.go
1211 // we don't use that directly because we don't want the whole namespaces package imported here
12 // (also, because we need minor modifications and it's not even exported)
1313
1414 // SetupUser changes the groups, gid, and uid for the user inside the container
1515 func SetupUser(u string) error {
2929 }
3030 execUser, err := user.GetExecUserPath(u, &defaultExecUser, passwdPath, groupPath)
3131 if err != nil {
32 return fmt.Errorf("get supplementary groups %s", err)
32 return err
3333 }
3434 if err := syscall.Setgroups(execUser.Sgids); err != nil {
35 return fmt.Errorf("setgroups %s", err)
35 return err
3636 }
3737 if err := system.Setgid(execUser.Gid); err != nil {
38 return fmt.Errorf("setgid %s", err)
38 return err
3939 }
4040 if err := system.Setuid(execUser.Uid); err != nil {
41 return fmt.Errorf("setuid %s", err)
41 return err
4242 }
4343 // if we didn't get HOME already, set it based on the user's HOME
4444 if envHome := os.Getenv("HOME"); envHome == "" {
4545 if err := os.Setenv("HOME", execUser.Home); err != nil {
46 return fmt.Errorf("set HOME %s", err)
46 return err
4747 }
4848 }
4949 return nil
00 package main
11
2 const Version = "1.6"
2 const Version = "1.7"