Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions skaffold-duct-tape/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,10 @@ are packaged into an image container suitable for use as an
`initContainer` on a pod.

Currently supported:
* None!
* Go: provides [Delve](https://github.com/go-delve/delve)
* Python: provides [`ptvsd`](https://github.com/Microsoft/ptvsd),
a debug adapter that can be used for VS Code and more

In Progress:

* Go: provides Delve

## Development

Expand Down
24 changes: 13 additions & 11 deletions skaffold-duct-tape/duct-tape/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,19 @@ RUN curl --location --output delve-1.2.0.tar.gz https://github.com/go-delve/delv
&& tar xzf delve-1.2.0.tar.gz
RUN cd delve-1.2.0/cmd/dlv && go install

#
#FROM python:2.7 as python27
#RUN curl --location --output ptsvd.zip https://github.com/Microsoft/ptvsd/archive/v4.2.4.zip \
# && unzip ptsvd.zip \
# && cd ptsvd-4.2.4 \
# &&
FROM python:2.7 as python27
RUN PYTHONUSERBASE=/ptvsd pip install --user ptvsd

FROM python:3.7 as python37
RUN PYTHONUSERBASE=/ptvsd pip install --user ptvsd

# Now populate the duct-tape image with the language runtime debugging support files
# The debian image is about 95MB bigger
FROM gcr.io/distroless/base:debug
SHELL ["/busybox/sh","-c"]
WORKDIR /duct-tape
COPY --from=delve /go/bin/dlv .
FROM busybox
# The install script copies all files in /duct-tape to /dbg
COPY install.sh /
ENTRYPOINT ["/busybox/sh", "/install.sh"]
CMD ["/bin/sh", "/install.sh"]
WORKDIR /duct-tape
COPY --from=delve /go/bin/dlv go/bin/
COPY --from=python27 /ptvsd/ python/
COPY --from=python37 /ptvsd/ python/
9 changes: 4 additions & 5 deletions skaffold-duct-tape/duct-tape/install.sh
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
#!/bin/sh

set -e
echo "This is the duct-tape installation script!"

if [ ! -d /dbg ]; then
echo "Debugging installation requires a volume mount at /dbg" 1>&2
echo "Error: installation requires a volume mount at /dbg" 1>&2
exit 1
fi

# Install Delve for Go
cp -p /duct-tape/dlv /dbg
echo "Installing runtime debugging support files in /dbg"
tar cf - -C /duct-tape . | tar xf - -C /dbg
echo "Installation complete"
14 changes: 0 additions & 14 deletions skaffold-duct-tape/k8s-pod.yaml.orig

This file was deleted.

10 changes: 9 additions & 1 deletion skaffold-duct-tape/skaffold.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,15 @@ build:
artifacts:
- image: gcr.io/gcp-dev-tools/duct-tape
context: duct-tape

# simple image that lists the contents of / and /dbg
- image: test-image
context: test/test-image
test:
- image: gcr.io/gcp-dev-tools/duct-tape
structureTests:
- ./test/duct-tape-structure-tests.yaml
deploy:
kubectl:
manifests:
- k8s-*
- test/k8s-test-installation.yaml
10 changes: 10 additions & 0 deletions skaffold-duct-tape/test/duct-tape-structure-tests.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
schemaVersion: 2.0.0

fileExistenceTests:
- name: 'dlv'
path: '/duct-tape/go/bin/dlv'
shouldExist: true
- name: 'ptvsd for python 2.7'
path: '/duct-tape/python/lib/python2.7/site-packages/ptvsd/__init__.py'
- name: 'ptvsd for python 3.7'
path: '/duct-tape/python/lib/python3.7/site-packages/ptvsd/__init__.py'
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,8 @@ spec:
- name: dbg
mountPath: "/dbg"
containers:
- name: helloworld1
image: busybox
command: ['sh', '-c', 'echo "The app is running"; ls / /dbg; sleep 3600']
volumeMounts:
- name: dbg
mountPath: "/dbg"
readOnly: true
- name: helloworld2
image: busybox
command: ['sh', '-c', 'echo "The app is running"; ls / /dbg; sleep 3600']
- name: test-image
image: test-image
volumeMounts:
- name: dbg
mountPath: "/dbg"
Expand Down
2 changes: 2 additions & 0 deletions skaffold-duct-tape/test/test-image/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
FROM busybox
CMD echo ">> root: /"; ls /; echo ">> /dbg"; ls /dbg; echo ">> sleeping for 10s"; sleep 10