Skip to content

Commit 93d0915

Browse files
authored
Merge pull request #80 from ktock/readme-dev1
Update documents with the latest buildg (Preparation for v0.4.0)
2 parents 6f0799b + 7dd37ee commit 93d0915

File tree

7 files changed

+46
-52
lines changed

7 files changed

+46
-52
lines changed

.dockerignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
docs
2-
extras
32
examples
43
out

.github/workflows/tests.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,6 @@ jobs:
2727
fail-fast: false
2828
matrix:
2929
mode: ["root", "rootless"]
30-
env:
31-
ROOTLESSKIT_VERSION: v1.0.1
32-
SLIRP4NETNS_VERSION: v1.2.0
3330
steps:
3431
- uses: actions/setup-go@v3
3532
with:

README.md

Lines changed: 43 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
- Source-level inspection
99
- Breakpoints and step execution
1010
- Interactive shell on a step with your own debugigng tools
11-
- Based on BuildKit (needs unmerged patches)
11+
- Based on BuildKit (with unmerged patches)
1212
- Supports rootless
1313

1414
**early stage software** This is implemented based on BuildKit with some unmerged patches. We're planning to upstream them.
@@ -19,7 +19,7 @@
1919
buildg debug /path/to/build/context
2020
```
2121

22-
To use your own image for debugging steps:
22+
To bring your own image for debugging steps:
2323

2424
```
2525
buildg debug --image=debugging-tools /path/to/build/context
@@ -44,21 +44,26 @@ COPY --from=build2 /hi /
4444
```
4545

4646
Store this Dockerfile to somewhere (e.g. `/tmp/ctx/Dockerfile`) then run `buildg debug`.
47-
`buildg.sh` can be used for rootless execution (discussed later).
4847

4948
```console
50-
$ buildg.sh debug --image=ubuntu:22.04 /tmp/ctx
51-
WARN[2022-05-17T09:01:16Z] using host network as the default
49+
$ buildg debug --image=ubuntu:22.04 /tmp/ctx
50+
WARN[2022-09-05T16:43:59+09:00] using host network as the default
5251
#1 [internal] load build definition from Dockerfile
5352
#1 transferring dockerfile: 195B done
54-
#1 DONE 0.1s
53+
#1 DONE 0.0s
5554

5655
#2 [internal] load .dockerignore
5756
#2 transferring context: 2B done
58-
#2 DONE 0.1s
57+
#2 DONE 0.0s
5958

6059
#3 [internal] load metadata for docker.io/library/busybox:latest
61-
INFO[2022-05-17T09:01:19Z] debug session started. type "help" for command reference.
60+
#3 ...
61+
62+
#4 [auth] library/busybox:pull token for registry-1.docker.io
63+
#4 DONE 0.0s
64+
65+
#3 [internal] load metadata for docker.io/library/busybox:latest
66+
INFO[2022-09-05T16:44:03+09:00] debug session started. type "help" for command reference.
6267
Filename: "Dockerfile"
6368
=> 1| FROM busybox AS build1
6469
2| RUN echo hello > /hello
@@ -72,12 +77,15 @@ Filename: "Dockerfile"
7277
[0]: line: Dockerfile:5
7378
[on-fail]: breaks on fail
7479
(buildg) continue
75-
#3 DONE 3.2s
76-
77-
#4 [build2 1/2] FROM docker.io/library/busybox@sha256:d2b53584f580310186df7a2055ce3ff83cc0df6caacf1e3489bff8cf5d0af5d8
78-
#4 resolve docker.io/library/busybox@sha256:d2b53584f580310186df7a2055ce3ff83cc0df6caacf1e3489bff8cf5d0af5d8 0.0s done
79-
#4 sha256:50e8d59317eb665383b2ef4d9434aeaa394dcd6f54b96bb7810fdde583e9c2d1 0B / 772.81kB 0.2s
80-
#4 sha256:50e8d59317eb665383b2ef4d9434aeaa394dcd6f54b96bb7810fdde583e9c2d1 772.81kB / 772.81kB 0.9s done
80+
#3 DONE 3.3s
81+
82+
#5 [build2 1/2] FROM docker.io/library/busybox@sha256:20142e89dab967c01765b0aea3be4cec3a5957cc330f061e5503ef6168ae6613
83+
#5 resolve docker.io/library/busybox@sha256:20142e89dab967c01765b0aea3be4cec3a5957cc330f061e5503ef6168ae6613 0.0s done
84+
#5 sha256:2c39bef88607fd321a97560db2e2c6d029a30189c98fafb75240db93c26633ad 0B / 773.28kB 0.2s
85+
#5 sha256:2c39bef88607fd321a97560db2e2c6d029a30189c98fafb75240db93c26633ad 773.28kB / 773.28kB 0.3s done
86+
#5 extracting sha256:2c39bef88607fd321a97560db2e2c6d029a30189c98fafb75240db93c26633ad 0.0s done
87+
#5 DONE 14.6s
88+
INFO[2022-09-05T16:44:18+09:00] detected 127.0.0.53 nameserver, assuming systemd-resolved, so using resolv.conf: /run/systemd/resolve/resolv.conf
8189
Breakpoint[0]: reached line: Dockerfile:5
8290
Filename: "Dockerfile"
8391
2| RUN echo hello > /hello
@@ -89,10 +97,10 @@ Filename: "Dockerfile"
8997
8| COPY --from=build1 /hello /
9098
(buildg) exec --image sh
9199
# cat /etc/os-release
92-
PRETTY_NAME="Ubuntu 22.04 LTS"
100+
PRETTY_NAME="Ubuntu 22.04.1 LTS"
93101
NAME="Ubuntu"
94102
VERSION_ID="22.04"
95-
VERSION="22.04 LTS (Jammy Jellyfish)"
103+
VERSION="22.04.1 LTS (Jammy Jellyfish)"
96104
VERSION_CODENAME=jammy
97105
ID=ubuntu
98106
ID_LIKE=debian
@@ -120,28 +128,20 @@ See [`./examples/dap/README.md`](./examples/dap/README.md) for usage of DAP.
120128

121129
## Install
122130

123-
- Requirements
124-
- [runc](https://github.com/opencontainers/runc)
125-
- [OPTIONAL] [RootlessKit](https://github.com/rootless-containers/rootlesskit) and [slirp4netns](https://github.com/rootless-containers/slirp4netns) for rootless execution
126-
127-
> NOTE: Native execution is supported only on Linux as of now. On other platforms, please run buildg on Linux VM (e.g. [Lima](https://github.com/lima-vm/lima), etc)
128-
129-
### Release binaries
131+
Binaries are available from https://github.com/ktock/buildg/releases
130132

131-
Available from https://github.com/ktock/buildg/releases
133+
Requirements:
132134

133-
### Rootless mode
135+
- [runc](https://github.com/opencontainers/runc)
136+
- [OPTIONAL] [RootlessKit](https://github.com/rootless-containers/rootlesskit) and [slirp4netns](https://github.com/rootless-containers/slirp4netns) for rootless execution
134137

135-
Install and use [`buildg.sh`](./extras/buildg.sh).
136-
[RootlessKit](https://github.com/rootless-containers/rootlesskit) and [slirp4netns](https://github.com/rootless-containers/slirp4netns) are needed.
138+
They are included in our release tar `buildg-full-<version>-<os>-<arch>.tar.gz` but not included in `buildg-<version>-<os>-<arch>.tar.gz`.
137139

138-
```
139-
$ buildg.sh debug /path/to/context
140-
```
140+
> NOTE1: Native execution is supported only on Linux as of now. On other platforms, please run buildg on Linux VM (e.g. [Lima](https://github.com/lima-vm/lima), etc)
141141
142-
> NOTE: [buildg on IDEs (VS Code, Emacs, Neovim, etc.)](./examples/dap/) require this configuration
142+
> NOTE2: [buildg on IDEs (VS Code, Emacs, Neovim, etc.)](./examples/dap/) requires rootless execution
143143
144-
The doc in BuildKit project for troubleshooting: https://github.com/moby/buildkit/blob/master/docs/rootless.md#troubleshooting
144+
> NOTE3: For troubleshooting rootless mode, please see also the doc provided by BuildKit: https://github.com/moby/buildkit/blob/master/docs/rootless.md#troubleshooting
145145
146146
### Building binary using make
147147

@@ -165,14 +165,21 @@ $ nerdctl builder debug /path/to/build/context
165165
### Docker
166166

167167
You can run buildg inside Docker.
168+
Images are available at `ghcr.io/ktock/buildg`.
168169
You need to bind mount the build context to the container.
169170

170171
```
171-
docker build -t buildg .
172-
docker run --rm -it --privileged -v /path/to/ctx:/ctx:ro buildg debug /ctx
172+
$ docker run --rm -it --privileged -v /path/to/ctx:/ctx:ro ghcr.io/ktock/buildg:0.4.0 debug /ctx
173+
```
174+
175+
You can also build this container image on the buildg repo.
176+
177+
```
178+
$ docker build -t buildg .
179+
$ docker run --rm -it --privileged -v /path/to/ctx:/ctx:ro buildg debug /ctx
173180
```
174181

175-
You can also use [bake command by Docker Buildx](https://docs.docker.com/engine/reference/commandline/buildx_bake/):
182+
You can also use [bake command by Docker Buildx](https://docs.docker.com/engine/reference/commandline/buildx_bake/) to build the container:
176183

177184
```
178185
docker buildx bake --set image-local.tags=buildg
@@ -246,7 +253,7 @@ Flags:
246253
- `--secret value` : Secret value exposed to the build. Format: `id=secretname,src=filepath`
247254
- `--ssh value` : Allow forwarding SSH agent to the build. Format: `default|<id>[=<socket>|<key>[,<key>]]`
248255
- `--cache-from value`: Import build cache from the specified location. e.g. `user/app:cache`, `type=local,src=path/to/dir` (see [`./docs/cache-from.md`](./docs/cache-from.md))
249-
- `--cache-reuse` : Reuse locally cached previous results (enabled by default).
256+
- `--cache-reuse` : Reuse locally cached previous results (enabled by default). Sharing cache among parallel buildg processes isn't supported as of now.
250257
251258
## buildg prune
252259

docs/cache-from.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ Finally, you can load and inspect the build cache using buildg with `--cache-fro
5353
This allows inspecting steps without running them but leveraging the build cache loaded from the specified location.
5454

5555
```console
56-
$ buildg.sh debug --cache-from=ghcr.io/ktock/myimagecache:debug /tmp/buildctx/
56+
$ buildg debug --cache-from=ghcr.io/ktock/myimagecache:debug /tmp/buildctx/
5757
WARN[2022-06-03T15:24:03+09:00] using host network as the default
5858
#1 [internal] load build definition from Dockerfile
5959
#1 transferring dockerfile: 319B done

examples/dap/emacs/dap-dockerfile.el

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"Populate CONF with the default arguments."
88
(-> conf
99
(dap--put-if-absent :program buffer-file-name)
10-
(dap--put-if-absent :dap-server-path (list "buildg.sh" "dap" "serve"))))
10+
(dap--put-if-absent :dap-server-path (list "buildg" "dap" "serve"))))
1111

1212
(dap-register-debug-template "Dockerfile Debug Configuration"
1313
(list :type "dockerfile"

examples/dap/nvim/plugins.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ local dap = require("dap")
66

77
dap.adapters.dockerfile = {
88
type = 'executable';
9-
command = 'buildg.sh';
9+
command = 'buildg';
1010
args = { 'dap', "serve" };
1111
}
1212

extras/buildg.sh

Lines changed: 0 additions & 9 deletions
This file was deleted.

0 commit comments

Comments
 (0)