Skip to content

Commit 3787d26

Browse files
committed
hack: add docker-compose file for development
This adds a simple docker compose file for development. The development version of buildkit will build with the dockerfile, set debug to true, use a tcp address to be compatible with the remote driver, and enable the debug image through delve to allow for remote debugging. It also configures additional services for help with development. At the moment, this only includes jaeger for collecting traces but can also include additional services in the future for things like metrics collection. Signed-off-by: Jonathan A. Sternberg <[email protected]>
1 parent 8849789 commit 3787d26

File tree

4 files changed

+88
-0
lines changed

4 files changed

+88
-0
lines changed

hack/compose

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
#!/usr/bin/env bash
2+
3+
# Use to set up a dev environment for buildkit.
4+
# Not meant for production deployments.
5+
# Use the same way you would use docker compose.
6+
#
7+
# $ hack/compose up -d --build
8+
#
9+
# Can be extended for local development by adding
10+
# a compose.override.yaml file to the same directory.
11+
#
12+
# Additional config files for extra services can
13+
# also be placed in the same folder and they will
14+
# be automatically ignored by git.
15+
#
16+
# To access the newly created development buildkit,
17+
# use either:
18+
#
19+
# $ buildctl --addr tcp://127.0.0.1:1234 ...
20+
#
21+
# or alternatively configure a new builder with buildx.
22+
#
23+
# $ docker buildx create \
24+
# --bootstrap \
25+
# --name dev \
26+
# --driver remote \
27+
# tcp://127.0.0.1:1234
28+
# $ docker buildx --builder dev ...
29+
30+
. $(dirname $0)/util
31+
set -eu -o pipefail
32+
33+
filesDir=$(dirname $0)/composefiles
34+
35+
args=(compose '-f' "$filesDir/compose.yaml")
36+
if [ -f "$filesDir/compose.override.yaml" ]; then
37+
args+=('-f' "$filesDir/compose.override.yaml")
38+
fi
39+
40+
dockerCmd "${args[@]}" "$@"

hack/composefiles/.gitignore

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Exclude everything to allow this folder to be used for other service
2+
# configurations.
3+
*
4+
5+
# Specifically allow certain configuration files.
6+
!.gitignore
7+
!buildkitd.toml
8+
!compose.yaml

hack/composefiles/buildkitd.toml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
debug = true
2+
3+
[grpc]
4+
address = [ "tcp://0.0.0.0:1234" ]
5+
debugAddress = "0.0.0.0:6060"

hack/composefiles/compose.yaml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: buildkit
2+
services:
3+
buildkit:
4+
container_name: buildkit-dev
5+
build:
6+
context: ../..
7+
args:
8+
BUILDKIT_DEBUG: 1
9+
image: moby/buildkit:local
10+
ports:
11+
- 127.0.0.1:1234:1234
12+
- 127.0.0.1:5000:5000
13+
- 127.0.0.1:6060:6060
14+
restart: always
15+
privileged: true
16+
environment:
17+
DELVE_PORT: 5000
18+
OTEL_EXPORTER_OTLP_TRACES_ENDPOINT: http://jaeger:4317
19+
configs:
20+
- source: buildkit_config
21+
target: /etc/buildkit/buildkitd.toml
22+
volumes:
23+
- buildkit:/var/lib/buildkit
24+
25+
jaeger:
26+
image: jaegertracing/all-in-one:latest
27+
ports:
28+
- 127.0.0.1:16686:16686
29+
30+
volumes:
31+
buildkit:
32+
33+
configs:
34+
buildkit_config:
35+
file: ./buildkitd.toml

0 commit comments

Comments
 (0)