Skip to content

Commit 592809a

Browse files
authored
Reorganize and split into separate runtime components (#25)
* Add travis build support * Rename dotnet -> netcore
1 parent e50e192 commit 592809a

17 files changed

Lines changed: 204 additions & 95 deletions

.travis.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
sudo: false
2+
services:
3+
- docker
4+
install:
5+
- mkdir -p $HOME/bin
6+
- curl -Lo $HOME/bin/skaffold https://storage.googleapis.com/skaffold/releases/latest/skaffold-linux-amd64
7+
- curl -Lo $HOME/bin/container-structure-test https://storage.googleapis.com/container-structure-test/latest/container-structure-test-linux-amd64
8+
- chmod +x $HOME/bin/*
9+
- export PATH=$HOME/bin:$PATH
10+
script:
11+
- skaffold build -p local

README.md

Lines changed: 34 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,37 @@
11
![experimental](https://img.shields.io/badge/stability-experimental-orange.svg)
22

3-
# Container Runtime Debugging Support
3+
# Container Runtime Debugging Support (aka Duct Tape)
44

5-
In development
5+
_Caution: this is work-in-progress_
6+
7+
This repository gathers additional dependencies required to debug
8+
particular language runtimes with [`skaffold debug`](https://skaffold.dev/docs/how-tos/debug/).
9+
These dependencies are packaged as a set of container images suitable
10+
for use as `initContainer`s on a pod. When executed, a container image
11+
copies these dependencies to `/dbg/<runtimeId>`.
12+
13+
The idea is that `skaffold debug` will transform k8s manifests to
14+
make available any support files required to debug specific language
15+
runtimes. For example, a Kubernetes podspec would be transformed to
16+
17+
- mount a volume on `/dbg` to hold the debugging support files
18+
- run one or more of these `initContainer`s to populate the volume
19+
- mount the volume on the applicable containers as `/dbg`
20+
21+
Current language runtimes:
22+
* `go`: provides [Delve](https://github.com/go-delve/delve)
23+
* `python`: provides [`ptvsd`](https://github.com/Microsoft/ptvsd),
24+
a debug adapter that can be used for VS Code and more, for
25+
Python 2.7 and 3.7
26+
* `netcore`: provides `vsdbg` for .NET Core
27+
28+
## Development
29+
30+
This directory includes a `skaffold.yaml` for development of the
31+
these `duct-tape` initContainer images. Each image is expected to
32+
be standalone and not require downloading content across the network.
33+
To add support for a new language runtime, an image definition
34+
should download the necessary files into the container image. The
35+
image's entrypoint should then copy those files into place at
36+
`/dbg/<runtime>`. The image should be added to the `skaffold.yaml`
37+
and referenced within `test/k8s-test-installation.yaml`.

go/Dockerfile

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
FROM golang:1.11 as delve
2+
RUN curl --location --output delve-1.2.0.tar.gz https://github.com/go-delve/delve/archive/v1.2.0.tar.gz \
3+
&& tar xzf delve-1.2.0.tar.gz
4+
RUN cd delve-1.2.0/cmd/dlv && go install
5+
6+
# Now populate the duct-tape image with the language runtime debugging support files
7+
# The debian image is about 95MB bigger
8+
FROM busybox
9+
# The install script copies all files in /duct-tape to /dbg
10+
COPY install.sh /
11+
CMD ["/bin/sh", "/install.sh"]
12+
WORKDIR /duct-tape
13+
COPY --from=delve /go/bin/dlv go/bin/
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,3 @@
1-
FROM golang:1.11 as delve
2-
RUN curl --location --output delve-1.2.0.tar.gz https://github.com/go-delve/delve/archive/v1.2.0.tar.gz \
3-
&& tar xzf delve-1.2.0.tar.gz
4-
RUN cd delve-1.2.0/cmd/dlv && go install
5-
6-
FROM python:2.7 as python27
7-
RUN PYTHONUSERBASE=/ptvsd pip install --user ptvsd
8-
9-
FROM python:3.7 as python37
10-
RUN PYTHONUSERBASE=/ptvsd pip install --user ptvsd
11-
121
FROM mcr.microsoft.com/dotnet/core/aspnet:2.1 as netcore
132
RUN apt-get update \
143
&& apt-get install -y --no-install-recommends unzip \
@@ -21,7 +10,4 @@ FROM busybox
2110
COPY install.sh /
2211
CMD ["/bin/sh", "/install.sh"]
2312
WORKDIR /duct-tape
24-
COPY --from=delve /go/bin/dlv go/bin/
25-
COPY --from=python27 /ptvsd/ python/
26-
COPY --from=python37 /ptvsd/ python/
2713
COPY --from=netcore /vsdbg/ netcore/

netcore/install.sh

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#!/bin/sh
2+
set -e
3+
4+
if [ ! -d /dbg ]; then
5+
echo "Error: installation requires a volume mount at /dbg" 1>&2
6+
exit 1
7+
fi
8+
9+
echo "Installing runtime debugging support files in /dbg"
10+
tar cf - -C /duct-tape . | tar xf - -C /dbg
11+
echo "Installation complete"

python/Dockerfile

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
FROM python:2.7 as python27
2+
RUN PYTHONUSERBASE=/ptvsd pip install --user ptvsd
3+
4+
FROM python:3.7 as python37
5+
RUN PYTHONUSERBASE=/ptvsd pip install --user ptvsd
6+
7+
# Now populate the duct-tape image with the language runtime debugging support files
8+
# The debian image is about 95MB bigger
9+
FROM busybox
10+
# The install script copies all files in /duct-tape to /dbg
11+
COPY install.sh /
12+
CMD ["/bin/sh", "/install.sh"]
13+
WORKDIR /duct-tape
14+
COPY --from=python27 /ptvsd/ python/
15+
COPY --from=python37 /ptvsd/ python/

python/install.sh

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#!/bin/sh
2+
set -e
3+
4+
if [ ! -d /dbg ]; then
5+
echo "Error: installation requires a volume mount at /dbg" 1>&2
6+
exit 1
7+
fi
8+
9+
echo "Installing runtime debugging support files in /dbg"
10+
tar cf - -C /duct-tape . | tar xf - -C /dbg
11+
echo "Installation complete"

skaffold-duct-tape/README.md

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

skaffold-duct-tape/skaffold.yaml

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

0 commit comments

Comments
 (0)