diff --git a/examples/google-cloud-build/Dockerfile b/examples/google-cloud-build/Dockerfile new file mode 100644 index 00000000000..184d6cce3e3 --- /dev/null +++ b/examples/google-cloud-build/Dockerfile @@ -0,0 +1,7 @@ +FROM golang:1.10.1-alpine3.7 as builder +COPY main.go . +RUN go build -o /app main.go + +FROM alpine:3.7 +CMD ["./app"] +COPY --from=builder /app . diff --git a/examples/google-cloud-build/README.adoc b/examples/google-cloud-build/README.adoc new file mode 100644 index 00000000000..ba15fd56e93 --- /dev/null +++ b/examples/google-cloud-build/README.adoc @@ -0,0 +1,33 @@ +=== Example: Getting started with a simple go app +:icons: font + +This is a simple example based on + +* *building* a single go file app and with a multistage `Dockerfile` using local docker to build +* *tagging* using the default tagPolicy (`gitCommit`) +* *deploying* a single container pod using `kubectl` + +ifndef::env-github[] +==== link:{github-repo-tree}/examples/getting-started[Example files icon:github[]] + +[source,yaml, indent=3, title=skaffold.yaml] +---- +include::skaffold.yaml[] +---- + +[source,go, indent=3, title=main.go, syntax=go] +---- +include::main.go[] +---- + +[source,docker, indent=3, title=Dockerfile] +---- +include::Dockerfile[] +---- + +[source,yaml, indent=3, title=k8s-pod.yaml] +---- +include::k8s-pod.yaml[] +---- + +endif::[] diff --git a/examples/google-cloud-build/k8s-pod.yaml b/examples/google-cloud-build/k8s-pod.yaml new file mode 100644 index 00000000000..14cc6911607 --- /dev/null +++ b/examples/google-cloud-build/k8s-pod.yaml @@ -0,0 +1,8 @@ +apiVersion: v1 +kind: Pod +metadata: + name: getting-started +spec: + containers: + - name: getting-started + image: gcr.io/k8s-skaffold/skaffold-example diff --git a/examples/google-cloud-build/skaffold.yaml b/examples/google-cloud-build/skaffold.yaml new file mode 100644 index 00000000000..8dc38f1676f --- /dev/null +++ b/examples/google-cloud-build/skaffold.yaml @@ -0,0 +1,11 @@ +apiVersion: skaffold/v1beta8 +kind: Config +build: + artifacts: + - image: gcr.io/k8s-skaffold/skaffold-example + googleCloudBuild: + projectId: k8s-skaffold +deploy: + kubectl: + manifests: + - k8s-* diff --git a/integration/examples/google-cloud-build/Dockerfile b/integration/examples/google-cloud-build/Dockerfile new file mode 100644 index 00000000000..184d6cce3e3 --- /dev/null +++ b/integration/examples/google-cloud-build/Dockerfile @@ -0,0 +1,7 @@ +FROM golang:1.10.1-alpine3.7 as builder +COPY main.go . +RUN go build -o /app main.go + +FROM alpine:3.7 +CMD ["./app"] +COPY --from=builder /app . diff --git a/integration/examples/google-cloud-build/README.adoc b/integration/examples/google-cloud-build/README.adoc new file mode 100644 index 00000000000..ba15fd56e93 --- /dev/null +++ b/integration/examples/google-cloud-build/README.adoc @@ -0,0 +1,33 @@ +=== Example: Getting started with a simple go app +:icons: font + +This is a simple example based on + +* *building* a single go file app and with a multistage `Dockerfile` using local docker to build +* *tagging* using the default tagPolicy (`gitCommit`) +* *deploying* a single container pod using `kubectl` + +ifndef::env-github[] +==== link:{github-repo-tree}/examples/getting-started[Example files icon:github[]] + +[source,yaml, indent=3, title=skaffold.yaml] +---- +include::skaffold.yaml[] +---- + +[source,go, indent=3, title=main.go, syntax=go] +---- +include::main.go[] +---- + +[source,docker, indent=3, title=Dockerfile] +---- +include::Dockerfile[] +---- + +[source,yaml, indent=3, title=k8s-pod.yaml] +---- +include::k8s-pod.yaml[] +---- + +endif::[] diff --git a/integration/examples/google-cloud-build/k8s-pod.yaml b/integration/examples/google-cloud-build/k8s-pod.yaml new file mode 100644 index 00000000000..14cc6911607 --- /dev/null +++ b/integration/examples/google-cloud-build/k8s-pod.yaml @@ -0,0 +1,8 @@ +apiVersion: v1 +kind: Pod +metadata: + name: getting-started +spec: + containers: + - name: getting-started + image: gcr.io/k8s-skaffold/skaffold-example diff --git a/integration/examples/google-cloud-build/skaffold.yaml b/integration/examples/google-cloud-build/skaffold.yaml new file mode 100644 index 00000000000..8dc38f1676f --- /dev/null +++ b/integration/examples/google-cloud-build/skaffold.yaml @@ -0,0 +1,11 @@ +apiVersion: skaffold/v1beta8 +kind: Config +build: + artifacts: + - image: gcr.io/k8s-skaffold/skaffold-example + googleCloudBuild: + projectId: k8s-skaffold +deploy: + kubectl: + manifests: + - k8s-* diff --git a/integration/examples/structure-tests/skaffold.yaml b/integration/examples/structure-tests/skaffold.yaml index 93e01ed7a38..c8d27422cf4 100644 --- a/integration/examples/structure-tests/skaffold.yaml +++ b/integration/examples/structure-tests/skaffold.yaml @@ -12,10 +12,6 @@ deploy: manifests: - k8s-* profiles: - - name: gcb - build: - googleCloudBuild: - projectId: k8s-skaffold - name: test test: - image: gcr.io/k8s-skaffold/skaffold-example diff --git a/integration/run_test.go b/integration/run_test.go index ae32e36d823..2a0b7bc50f7 100644 --- a/integration/run_test.go +++ b/integration/run_test.go @@ -65,8 +65,7 @@ func TestRun(t *testing.T) { pods: []string{"bazel"}, }, { description: "Google Cloud Build", - dir: "examples/structure-tests", - args: []string{"-p", "gcb"}, + dir: "examples/google-cloud-build", pods: []string{"getting-started"}, remoteOnly: true, }, {