2019-04-12 07:38:33 +00:00
|
|
|
kind: pipeline
|
|
|
|
name: default
|
|
|
|
steps:
|
|
|
|
- name: setup
|
2019-04-12 07:31:39 +00:00
|
|
|
image: golang
|
|
|
|
commands:
|
|
|
|
- |
|
|
|
|
cat <<EOF > index.html
|
|
|
|
hello world
|
|
|
|
EOF
|
|
|
|
- |
|
|
|
|
cat <<EOF > Dockerfile
|
|
|
|
FROM busybox
|
|
|
|
ADD index.html /www/index.html
|
|
|
|
EXPOSE 8000
|
|
|
|
CMD httpd -p 8000 -h /www; tail -f /dev/null
|
|
|
|
EOF
|
2019-04-11 20:35:52 +00:00
|
|
|
|
2019-04-12 07:38:33 +00:00
|
|
|
- name: build
|
2019-04-12 07:31:39 +00:00
|
|
|
image: docker:dind
|
|
|
|
environment:
|
2019-04-12 07:39:36 +00:00
|
|
|
DOCKER_HOST=tcp://docker:2375
|
2019-04-12 07:31:39 +00:00
|
|
|
commands:
|
|
|
|
- sleep 5
|
|
|
|
- docker ps
|
|
|
|
- docker build -t hello-world .
|
|
|
|
|
|
|
|
# start the container using a detached (non-blocking)
|
|
|
|
# step. Bonus we can see our container logs in the
|
|
|
|
# build output.
|
2019-04-12 07:38:33 +00:00
|
|
|
- name: run
|
2019-04-12 07:31:39 +00:00
|
|
|
image: docker:dind
|
|
|
|
detach: true
|
|
|
|
environment:
|
2019-04-12 07:39:36 +00:00
|
|
|
DOCKER_HOST=tcp://docker:2375
|
2019-04-12 07:31:39 +00:00
|
|
|
commands:
|
|
|
|
- docker run -p 8000:8000 hello-world
|
2019-04-11 20:07:44 +00:00
|
|
|
|
2019-04-12 07:31:39 +00:00
|
|
|
# curl the container to test it is up and running.
|
|
|
|
# notice that we use `docker:8000` since the container
|
|
|
|
# is running in the docker service container.
|
2019-04-12 07:38:33 +00:00
|
|
|
- name: test
|
2019-04-12 07:31:39 +00:00
|
|
|
image: golang # because I know it has curl installed
|
|
|
|
commands:
|
|
|
|
- curl -v http://docker:8000
|
|
|
|
|
|
|
|
services:
|
2019-04-12 07:35:56 +00:00
|
|
|
- name: docker
|
|
|
|
image: docker:dind
|
|
|
|
privileged: true
|