Skip to content

Commit

Permalink
Reworked shell hello world example
Browse files Browse the repository at this point in the history
* 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)
  • Loading branch information
rhuss committed Nov 6, 2020
1 parent 3c9430b commit 39915a6
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 39915a6

Please sign in to comment.