diff --git a/codeship-services.yml b/codeship-services.yml new file mode 100644 index 0000000..c2d5900 --- /dev/null +++ b/codeship-services.yml @@ -0,0 +1,7 @@ +app: + build: ./codeship/ + cached: true + add_docker: true + working_dir: /app + volumes: + - .:/app diff --git a/codeship-steps.yml b/codeship-steps.yml new file mode 100644 index 0000000..87c0c44 --- /dev/null +++ b/codeship-steps.yml @@ -0,0 +1,18 @@ +- type: serial + name: examplezz + service: app + steps: + - command: ./drun -? + - command: sh -c "./drun -x ubuntu:16.04 cat /etc/issue | grep 'Ubuntu 16.04'" # should execute command inside container + - command: sh -c "./drun -x docker:1.10.0 docker version" # should bind docker.sock + - command: sh -c "./drun -x docker:1.10.0 sh -c './drun -x docker:1.10.0 true'" # should do inception in 2 levels + - command: sh -c "./drun -x docker:1.10.0 sh -c './drun -x docker:1.10.0 sh -c "./drun -x docker:1.10.0 true"'" # should do inception in 3 levels + - command: sh -c "./drun -x mhart/alpine-node:5.12.0 node --version | grep 'v5.12.0'" # should get version of node + - command: sh -c "echo '{"engines":{"node":"7.7.1"}}' > package.json && ./drun -xNA node --version | grep 'v7.7.1'" # should read version from package.json + - command: sh -c "echo '{"engines":{"node":"~7.7.1"}}' > package.json && ./drun -xNA node --version | grep 'v7.7.1'" # should read version from package.json + - command: sh -c "echo '{"engines":{"node":"^7.7.1"}}' > package.json && ./drun -xNA node --version | grep 'v7.7.1'" # should read version from package.json + - command: sh -c "echo '{"engines":{"node":">=7.7.1"}}' > package.json && ./drun -xNA node --version | grep 'v7.7.1'" # should read version from package.json + - command: sh -c "echo '{"engines":{"node":"7.7.1"}}' > package.json && ./drun -xNM slim node --version | grep 'v7.7.1'" # should read version from package.json node:7.7.1-slim image + - command: sh -c "echo '{"test":"passing"}' | ./drun -x stedolan/jq '.test' | grep '"passing"'" # should pipe into command inside container + - command: sh -c "echo '{"test":"passing"}' > test.json && ./drun -x stedolan/jq '.test' test.json | grep '"passing"'" # should mount current directory + - command: sh -c "checkbashisms -f drun && echo 'checkbashisms passed.'" diff --git a/codeship/Dockerfile b/codeship/Dockerfile new file mode 100644 index 0000000..8722e11 --- /dev/null +++ b/codeship/Dockerfile @@ -0,0 +1,3 @@ +FROM alpine + +RUN apk add --update docker jq curl checkbashisms diff --git a/drun b/drun index 6b05e68..1d17dd6 100755 --- a/drun +++ b/drun @@ -126,6 +126,7 @@ MAP_CURRENT_DIR_OPT="-v $CURRENT_DIR:$CONTAINER_HOME" if [ -f '/proc/1/cgroup' ]; then CURRENT_CONTAINER=$(grep '/docker/' -- /proc/1/cgroup | head -n1 | cut -d '/' -f 3) if [ -n "${CURRENT_CONTAINER}" ]; then + docker inspect ${CURRENT_CONTAINER} # DEBUG ONLY # Maps volumes from current container EXTRA_OPTS="${EXTRA_OPTS:-} --volumes-from $CURRENT_CONTAINER"