Skip to content

Commit 7ed1973

Browse files
akashrvknative-prow-robot
authored andcommitted
Hello world - Go for Knative Eventing. (#1862)
* App + readme * vendored packages - cloudevents/sdk-go and its dependencies * Mark-ups updated. Final testing on a new cluster pending. * final changes
1 parent 81bc837 commit 7ed1973

File tree

138 files changed

+15152
-19
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

138 files changed

+15152
-19
lines changed

Gopkg.lock

Lines changed: 81 additions & 19 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
Following examples include a simple web app written in the language of your choice that you can use to test knative eventing. It shows how to consume a [CloudEvent](https://cloudevents.io/) in Knative eventing, and optionally how to respond back with another CloudEvent in the http response.
2+
3+
We will deploy the app as a [Kubernetes Deployment](https://kubernetes.io/docs/concepts/workloads/controllers/deployment/) along with a [Kubernetes Service](https://kubernetes.io/docs/concepts/services-networking/service/). However, you can also deploy the app as a [Knative Serving Service](../../../../serving/README.md)
4+
5+
## Prerequisites
6+
7+
- A Kubernetes cluster with [Knative Eventing](../../getting-started.md#installing-knative-eventing) installed.
8+
- If you decide to deploy the app as a Knative Serving Service then you will have to install [Knative Serving](../../../install/README.md).
9+
- [Docker](https://www.docker.com) installed and running on your local machine,
10+
and a Docker Hub account configured (we'll use it for a container registry).
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
---
2+
title: "Knative Eventing - Hello World app"
3+
linkTitle: "Hello World"
4+
weight: 10
5+
type: "docs"
6+
---
7+
8+
{{% readfile file="README.md" relative="true" markdown="true" %}}
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# Use the offical Golang image to create a build artifact.
2+
# This is based on Debian and sets the GOPATH to /go.
3+
# https://hub.docker.com/_/golang
4+
FROM golang:1.12 as builder
5+
6+
# Copy local code to the container image.
7+
WORKDIR /go/src/github.com/knative/docs/helloworld
8+
COPY . .
9+
10+
# Build the command inside the container.
11+
# (You may fetch or manage dependencies here,
12+
# either manually or with a tool like "godep".)
13+
RUN curl -fsSL -o /usr/local/bin/dep https://github.com/golang/dep/releases/download/v0.5.4/dep-linux-amd64 && chmod +x /usr/local/bin/dep
14+
15+
RUN dep init
16+
RUN dep ensure -vendor-only
17+
18+
19+
RUN CGO_ENABLED=0 GOOS=linux go build -v -o helloworld
20+
21+
# Use a Docker multi-stage build to create a lean production image.
22+
# https://docs.docker.com/develop/develop-images/multistage-build/#use-multi-stage-builds
23+
FROM alpine
24+
RUN apk add --no-cache ca-certificates
25+
26+
# Copy the binary to the production image from the builder stage.
27+
COPY --from=builder /go/src/github.com/knative/docs/helloworld/helloworld /helloworld
28+
29+
# Run the web service on container startup.
30+
CMD ["/helloworld"]

0 commit comments

Comments
 (0)