Skip to content

Commit

Permalink
Reworked shell hello world example (knative#2832)
Browse files Browse the repository at this point in the history
* Change event type in Sequence with Broker example (knative#2897) (knative#2916)

If the type of the event isn't changed by the last step in the
sequence the event will be resent to the Trigger that targets
the sequence creating an unwanted loop.

Fixes knative#2851

Signed-off-by: Pierangelo Di Pilato <pierangelodipilato@gmail.com>

* Reworked shell hello world example

* Reworked example to be a "true" shell example that is considerable different than the helloworld-go example
* Added examples for kn usage

(Fixed according to review comments)

Co-authored-by: Pierangelo Di Pilato <pierangelodipilato@gmail.com>
  • Loading branch information
2 people authored and RichieEscarez committed Mar 6, 2021
1 parent 98e4c18 commit 063452e
Show file tree
Hide file tree
Showing 8 changed files with 235 additions and 279 deletions.
35 changes: 8 additions & 27 deletions docs/serving/samples/hello-world/helloworld-shell/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,32 +1,13 @@
# Use the official Golang image to create a build artifact.
# This is based on Debian and sets the GOPATH to /go.
# https://hub.docker.com/_/golang
FROM golang:1.13 as builder

# Create and change to the app directory.
WORKDIR /app

# Retrieve application dependencies using go modules.
# Allows container builds to reuse downloaded dependencies.
COPY go.* ./
RUN go mod download

# Copy local code to the container image.
COPY invoke.go ./

# Build the binary.
# -mod=readonly ensures immutable go.mod and go.sum in container builds.
RUN CGO_ENABLED=0 GOOS=linux go build -mod=readonly -v -o server

# Use the official Alpine image for a lean production container.
# https://hub.docker.com/_/alpine
# https://docs.docker.com/develop/develop-images/multistage-build/#use-multi-stage-builds
FROM alpine:3
RUN apk add --no-cache ca-certificates

# Copy the binary to the production image from the builder stage.
COPY --from=builder /app/server /server
COPY script.sh ./
# Update & install netcat (nc)
RUN apk update \
&& apk add netcat-openbsd

# Copy over the service script
COPY script.sh /

# Run the web service on container startup.
CMD ["/server"]
# Start up the webserver
CMD [ "/bin/sh", "/script.sh" ]
204 changes: 0 additions & 204 deletions docs/serving/samples/hello-world/helloworld-shell/README.md

This file was deleted.

3 changes: 0 additions & 3 deletions docs/serving/samples/hello-world/helloworld-shell/go.mod

This file was deleted.

Loading

0 comments on commit 063452e

Please sign in to comment.