Skip to content

Commit

Permalink
Manually run prettier.io (#880)
Browse files Browse the repository at this point in the history
* Manually run prettier.io

Trying to fix the stuff that hits prettier.io bugs.

* Fix prettier.io issues.
  • Loading branch information
mattmoor authored and RichieEscarez committed Feb 8, 2019
1 parent 31d23bd commit a95221b
Show file tree
Hide file tree
Showing 57 changed files with 1,073 additions and 857 deletions.
36 changes: 18 additions & 18 deletions community/samples/serving/helloworld-clojure/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,29 +59,29 @@ recreate the source files from this folder.
see
[the clojure image documentation](https://github.com/docker-library/docs/tree/master/clojure).

```docker
# Use the official Clojure image.
# https://hub.docker.com/_/clojure
FROM clojure
```docker
# Use the official Clojure image.
# https://hub.docker.com/_/clojure
FROM clojure
# Create the project and download dependencies.
WORKDIR /usr/src/app
COPY project.clj .
RUN lein deps
# Create the project and download dependencies.
WORKDIR /usr/src/app
COPY project.clj .
RUN lein deps
# Copy local code to the container image.
COPY . .
# Copy local code to the container image.
COPY . .
# Build an uberjar release artifact.
RUN mv "$(lein uberjar | sed -n 's/^Created \(.*standalone\.jar\)/\1/p')" app-standalone.jar
# Build an uberjar release artifact.
RUN mv "$(lein uberjar | sed -n 's/^Created \(.*standalone\.jar\)/\1/p')" app-standalone.jar
# Service must listen to $PORT environment variable.
# This default value facilitates local development.
ENV PORT 8080
# Service must listen to $PORT environment variable.
# This default value facilitates local development.
ENV PORT 8080
# Run the web service on container startup.
CMD ["java", "-jar", "app-standalone.jar"]
```
# Run the web service on container startup.
CMD ["java", "-jar", "app-standalone.jar"]
```

1. Create a new file, `service.yaml` and copy the following service definition
into the file. Make sure to replace `{username}` with your Docker Hub
Expand Down
18 changes: 9 additions & 9 deletions community/samples/serving/helloworld-dart/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,15 +71,15 @@ be created using the following instructions.
4. Create a new file named `Dockerfile`, this file defines instructions for
dockerizing your applications, for dart apps this can be done as follows:

```Dockerfile
# Use Google's official Dart image.
# https://hub.docker.com/r/google/dart-runtime/
FROM google/dart-runtime

# Service must listen to $PORT environment variable.
# This default value facilitates local development.
ENV PORT 8080
```
```Dockerfile
# Use Google's official Dart image.
# https://hub.docker.com/r/google/dart-runtime/
FROM google/dart-runtime

# Service must listen to $PORT environment variable.
# This default value facilitates local development.
ENV PORT 8080
```

5. Create a new file, `service.yaml` and copy the following service definition
into the file. Make sure to replace `{username}` with your Docker Hub
Expand Down
1 change: 0 additions & 1 deletion community/samples/serving/helloworld-elixir/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,6 @@ above.
xxxxxxx-ingressgateway LoadBalancer 10.23.247.74 35.203.155.229 80:32380/TCP,443:32390/TCP,32400:32400/TCP 2d
```


1. To find the URL for your service, use

```
Expand Down
56 changes: 28 additions & 28 deletions community/samples/serving/helloworld-haskell/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,34 +80,34 @@ recreate the source files from this folder.
1. In your project directory, create a file named `Dockerfile` and copy the code
block below into it.

```docker
# Use the official Haskell image to create a build artifact.
# https://hub.docker.com/_/haskell/
FROM haskell:8.2.2 as builder
# Copy local code to the container image.
WORKDIR /app
COPY . .
# Build and test our code, then build the “helloworld-haskell-exe” executable.
RUN stack setup
RUN stack build --copy-bins
# Use a Docker multi-stage build to create a lean production image.
# https://docs.docker.com/develop/develop-images/multistage-build/#use-multi-stage-builds
FROM fpco/haskell-scratch:integer-gmp
# Copy the "helloworld-haskell-exe" executable from the builder stage to the production image.
WORKDIR /root/
COPY --from=builder /root/.local/bin/helloworld-haskell-exe .
# Service must listen to $PORT environment variable.
# This default value facilitates local development.
ENV PORT 8080
# Run the web service on container startup.
CMD ["./helloworld-haskell-exe"]
```
```docker
# Use the official Haskell image to create a build artifact.
# https://hub.docker.com/_/haskell/
FROM haskell:8.2.2 as builder
# Copy local code to the container image.
WORKDIR /app
COPY . .
# Build and test our code, then build the “helloworld-haskell-exe” executable.
RUN stack setup
RUN stack build --copy-bins
# Use a Docker multi-stage build to create a lean production image.
# https://docs.docker.com/develop/develop-images/multistage-build/#use-multi-stage-builds
FROM fpco/haskell-scratch:integer-gmp
# Copy the "helloworld-haskell-exe" executable from the builder stage to the production image.
WORKDIR /root/
COPY --from=builder /root/.local/bin/helloworld-haskell-exe .
# Service must listen to $PORT environment variable.
# This default value facilitates local development.
ENV PORT 8080
# Run the web service on container startup.
CMD ["./helloworld-haskell-exe"]
```

1. Create a new file, `service.yaml` and copy the following service definition
into the file. Make sure to replace `{username}` with your Docker Hub
Expand Down
30 changes: 15 additions & 15 deletions community/samples/serving/helloworld-rust/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,25 +87,25 @@ recreate the source files from this folder.
1. In your project directory, create a file named `Dockerfile` and copy the code
block below into it.

```docker
# Use the official Rust image.
# https://hub.docker.com/_/rust
FROM rust:1.27.0
```docker
# Use the official Rust image.
# https://hub.docker.com/_/rust
FROM rust:1.27.0
# Copy local code to the container image.
WORKDIR /usr/src/app
COPY . .
# Copy local code to the container image.
WORKDIR /usr/src/app
COPY . .
# Install production dependencies and build a release artifact.
RUN cargo install
# Install production dependencies and build a release artifact.
RUN cargo install
# Service must listen to $PORT environment variable.
# This default value facilitates local development.
ENV PORT 8080
# Service must listen to $PORT environment variable.
# This default value facilitates local development.
ENV PORT 8080
# Run the web service on container startup.
CMD ["hellorust"]
```
# Run the web service on container startup.
CMD ["hellorust"]
```

1. Create a new file, `service.yaml` and copy the following service definition
into the file. Make sure to replace `{username}` with your Docker Hub
Expand Down
147 changes: 74 additions & 73 deletions community/samples/serving/helloworld-shell/README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# Hello World - Shell sample

A simple web app that executes a shell script.
The shell script reads an env variable `TARGET` and prints `Hello ${TARGET}!`.
If the `TARGET` environment variable is not specified, the script uses `World`.
A simple web app that executes a shell script. The shell script reads an env
variable `TARGET` and prints `Hello ${TARGET}!`. If the `TARGET` environment
variable is not specified, the script uses `World`.

## Prerequisites

Expand All @@ -20,83 +20,83 @@ recreate the source files from this folder.

1. Create a new file named `script.sh` and paste the following script:

```sh
#!/bin/sh
echo Hello ${TARGET:=World}
```

1. Create a new file named `invoke.go` and paste the following code.
We use a basic web server written in Go to execute the shell script:

```go
package main
import (
"fmt"
"log"
"net/http"
"os"
"os/exec"
)
func handler(w http.ResponseWriter, r *http.Request) {
cmd := exec.CommandContext(r.Context(), "/bin/sh", "script.sh")
cmd.Stderr = os.Stderr
out, err := cmd.Output()
if err != nil {
w.WriteHeader(500)
}
w.Write(out)
}
func main() {
http.HandleFunc("/", handler)
port := os.Getenv("PORT")
if port == "" {
port = "8080"
}
log.Fatal(http.ListenAndServe(fmt.Sprintf(":%s", port), nil))
}
```
```sh
#!/bin/sh
echo Hello ${TARGET:=World}
```

1. Create a new file named `invoke.go` and paste the following code. We use a
basic web server written in Go to execute the shell script:

```go
package main

import (
"fmt"
"log"
"net/http"
"os"
"os/exec"
)

func handler(w http.ResponseWriter, r *http.Request) {
cmd := exec.CommandContext(r.Context(), "/bin/sh", "script.sh")
cmd.Stderr = os.Stderr
out, err := cmd.Output()
if err != nil {
w.WriteHeader(500)
}
w.Write(out)
}

func main() {
http.HandleFunc("/", handler)

port := os.Getenv("PORT")
if port == "" {
port = "8080"
}

log.Fatal(http.ListenAndServe(fmt.Sprintf(":%s", port), nil))
}
```

1. Create a new file named `Dockerfile` and copy the code block below into it.

```docker
FROM golang:1.11
```docker
FROM golang:1.11
WORKDIR /go/src/invoke
WORKDIR /go/src/invoke
COPY invoke.go .
RUN go install -v
COPY invoke.go .
RUN go install -v
COPY . .
COPY . .
CMD ["invoke"]
```
CMD ["invoke"]
```

1. Create a new file, `service.yaml` and copy the following service definition
into the file. Make sure to replace `{username}` with your Docker Hub
username.

```yaml
apiVersion: serving.knative.dev/v1alpha1
kind: Service
metadata:
name: helloworld-shell
namespace: default
spec:
runLatest:
configuration:
revisionTemplate:
spec:
container:
image: docker.io/{username}/helloworld-shell
env:
- name: TARGET
value: "Shell"
```
```yaml
apiVersion: serving.knative.dev/v1alpha1
kind: Service
metadata:
name: helloworld-shell
namespace: default
spec:
runLatest:
configuration:
revisionTemplate:
spec:
container:
image: docker.io/{username}/helloworld-shell
env:
- name: TARGET
value: "Shell"
```
## Building and deploying the sample
Expand Down Expand Up @@ -126,9 +126,10 @@ folder) you're ready to build and deploy the sample app.

1. Now that your service is created, Knative performs the following steps:

- Create a new immutable revision for this version of the app.
- Network programming to create a route, ingress, service, and load balance for your app.
- Automatically scale your pods up and down (including to zero active pods).
- Create a new immutable revision for this version of the app.
- Network programming to create a route, ingress, service, and load balance
for your app.
- Automatically scale your pods up and down (including to zero active pods).

1. Run the following command to find the external IP address for your service.
The ingress IP for your cluster is returned. If you just created your
Expand Down Expand Up @@ -161,8 +162,8 @@ folder) you're ready to build and deploy the sample app.
```

1. Test your app by sending it a request. Use the following `curl` command with
the domain URL `helloworld-shell.default.example.com` and `EXTERNAL-IP` address
that you retrieved in the previous steps:
the domain URL `helloworld-shell.default.example.com` and `EXTERNAL-IP`
address that you retrieved in the previous steps:

```shell
curl -H "Host: helloworld-shell.default.example.com" http://{EXTERNAL_IP_ADDRESS}
Expand Down
Loading

0 comments on commit a95221b

Please sign in to comment.