Update state directory defaults

Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
docker-18.09
Tonis Tiigi 2017-10-15 21:13:47 +02:00
parent fac138e742
commit 5a2bedb683
4 changed files with 33 additions and 38 deletions

View File

@ -108,48 +108,17 @@ buildctl du -v
#### Running containerized buildkit
buildkit daemon supports communicating with clients over TCP. This is supports some use cases like:
* Docker for Mac or Windows users which cannot yet run natively buildkit daemon on their platform,
* Centralized daemon for remote build scripts execution in a team settings
* ...
buildkit can be also used by running the `buildd` daemon inside a Docker container and accessing it remotely. The client tool `buildctl` is also available for Mac and Windows.
To run daemon in a container:
```
$ docker run --rm --privileged -p 12345:12345 --tmpfs /tmp buildkit:buildd-standalone buildd-standalone --addr tcp://0.0.0.0:12345 --root /tmp/buildkit
docker run --d --privileged -p 1234:1234 tonistiigi/buildkit:standalone --addr tcp://0.0.0.0:1234
export BUILDKIT_HOST=tcp://0.0.0.0:1234
buildctl build --help
```
Notes:
* `--privileged` is needed to grant [enough rights](https://docs.docker.com/engine/reference/run/#runtime-privilege-and-linux-capabilities) to buildkit
* You need to make sure the --root directory exists on a filesystem that is supported by overlay filesystem. e.g. tmpfs, ext4, xfs.
Build a script:
```
$ go build examples/buildkit0
```
Run build script:
On MacOS:
```
$ ./buildkit0 | ./bin/buildctl-darwin --addr tcp://localhost:12345 build
```
On Windows:
```
$ ./buildkit0 | ./bin/buildctl.exe --addr tcp://localhost:12345 build
```
On Linux:
```
$ ./buildkit0 | ./bin/buildctl --addr tcp://localhost:12345 build
```
The `tonistiigi/buildkit:standalone` image can be built locally using the Dockerfile in `./hack/dockerfiles/test.Dockerfile`.
#### Supported runc version

View File

@ -16,6 +16,11 @@ func main() {
app.Name = "buildctl"
app.Usage = "build utility"
defaultAddress := os.Getenv("BUILDKIT_HOST")
if defaultAddress == "" {
defaultAddress = appdefaults.Address
}
app.Flags = []cli.Flag{
cli.BoolFlag{
Name: "debug",
@ -24,7 +29,7 @@ func main() {
cli.StringFlag{
Name: "addr",
Usage: "listening address",
Value: appdefaults.Address,
Value: defaultAddress,
},
}

View File

@ -1,5 +1,6 @@
ARG RUNC_VERSION=e775f0fba3ea329b8b766451c892c41a3d49594d
ARG CONTAINERD_VERSION=d1e11f17ec7b325f89608dd46c128300b8727d50
ARG BUILDKIT_TARGET=standalone
FROM golang:1.8-alpine@sha256:2287e0e274c1d2e9076c1f81d04f1a63c86b73c73603b09caada5da307a8f86d AS gobuild-base
RUN apk add --no-cache g++ linux-headers
@ -54,3 +55,23 @@ RUN go build -o /buildctl.exe ./cmd/buildctl
FROM cross-windows AS buildd.exe
RUN go build -o /buildd.exe ./cmd/buildd
# Copy together all binaries needed for standalone mode
FROM alpine AS buildkit-standalone
COPY --from=runc /usr/bin/runc /usr/bin/
COPY --from=buildd-standalone /usr/bin/buildd-standalone /usr/bin/
COPY --from=buildctl /usr/bin/buildctl /usr/bin/
ENTRYPOINT ["buildd-standalone"]
# Copy together all binaries for containerd mode
FROM alpine AS buildkit-containerd
COPY --from=buildd-containerd /usr/bin/buildd-containerd /usr/bin/
COPY --from=buildctl /usr/bin/buildctl /usr/bin/
COPY --from=runc /usr/bin/runc /usr/bin/
COPY --from=containerd /go/src/github.com/containerd/containerd/bin/containerd /usr/bin/
COPY --from=containerd /go/src/github.com/containerd/containerd/bin/containerd-shim /usr/bin/
ENTRYPOINT ["buildd-containerd"]
FROM buildkit-${BUILDKIT_TARGET}
RUN apk add --no-cache git
VOLUME /var/lib/buildkit

View File

@ -4,5 +4,5 @@ package appdefaults
const (
Address = "unix:///run/buildkit/buildd.sock"
Root = ".buildstate"
Root = "/var/lib/buildkit"
)