Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions serving/samples/helloworld-clojure/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ COPY . .
# Build an uberjar release artifact.
RUN mv "$(lein uberjar | sed -n 's/^Created \(.*standalone\.jar\)/\1/p')" app-standalone.jar

# Configure and document the service HTTP port.
# Service must listen to $PORT environment variable.
# This default value facilitates local development.
ENV PORT 8080
EXPOSE $PORT

# Run the web service on container startup.
CMD ["java", "-jar", "app-standalone.jar"]
36 changes: 18 additions & 18 deletions serving/samples/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

# Configure and document the service HTTP port.
ENV PORT 8080
EXPOSE $PORT
# 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
4 changes: 2 additions & 2 deletions serving/samples/helloworld-csharp/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ COPY . .
# Build a release artifact.
RUN dotnet publish -c Release -o out

# Configure and document the service HTTP port.
# Service must listen to $PORT environment variable.
# This default value facilitates local development.
ENV PORT 8080
EXPOSE $PORT

# Run the web service on container startup.
CMD ["dotnet", "out/helloworld-csharp.dll"]
48 changes: 24 additions & 24 deletions serving/samples/helloworld-csharp/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,30 +55,30 @@ recreate the source files from this folder.
app, see
[dockerizing a .NET core app](https://docs.microsoft.com/en-us/dotnet/core/docker/docker-basics-dotnet-core#dockerize-the-net-core-application).

```docker
# Use Microsoft's official .NET image.
# https://hub.docker.com/r/microsoft/dotnet
FROM microsoft/dotnet:2.1-sdk

# Install production dependencies.
# Copy csproj and restore as distinct layers.
WORKDIR /app
COPY *.csproj .
RUN dotnet restore

# Copy local code to the container image.
COPY . .

# Build a release artifact.
RUN dotnet publish -c Release -o out

# Configure and document the service HTTP port.
ENV PORT 8080
EXPOSE $PORT

# Run the web service on container startup.
CMD ["dotnet", "out/helloworld-csharp.dll"]
```
```docker
# Use Microsoft's official .NET image.
# https://hub.docker.com/r/microsoft/dotnet
FROM microsoft/dotnet:2.1-sdk

# Install production dependencies.
# Copy csproj and restore as distinct layers.
WORKDIR /app
COPY *.csproj .
RUN dotnet restore

# Copy local code to the container image.
COPY . .

# Build a release artifact.
RUN dotnet publish -c Release -o out

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

# Run the web service on container startup.
CMD ["dotnet", "out/helloworld-csharp.dll"]
```

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
4 changes: 2 additions & 2 deletions serving/samples/helloworld-dart/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
# https://hub.docker.com/r/google/dart-runtime/
FROM google/dart-runtime

# Configure and document the service HTTP port.
# Service must listen to $PORT environment variable.
# This default value facilitates local development.
ENV PORT 8080
EXPOSE $PORT
18 changes: 9 additions & 9 deletions serving/samples/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

# Configure and document the service HTTP port.
ENV PORT 8080
EXPOSE $PORT
```
```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 serving/samples/helloworld-elixir/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ USER appuser

ENV PORT=8080 MIX_ENV=prod REPLACE_OS_VARS=true
WORKDIR /opt/app
EXPOSE 8080
COPY --from=0 /opt/release .
ENV RUNNER_LOG_DIR /var/log
CMD ["/opt/app/bin/start_server", "foreground", "boot_var=/tmp"]
1 change: 0 additions & 1 deletion serving/samples/helloworld-elixir/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,6 @@ When asked, if you want to `Fetch and install dependencies? [Yn]` select `y`
# Document that the service listens on port 8080.
ENV PORT=8080 MIX_ENV=prod REPLACE_OS_VARS=true
WORKDIR /opt/app
EXPOSE 8080
COPY --from=0 /opt/release .
ENV RUNNER_LOG_DIR /var/log
Expand Down
4 changes: 2 additions & 2 deletions serving/samples/helloworld-go/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ FROM alpine
# Copy the binary to the production image from the builder stage.
COPY --from=builder /go/src/github.com/knative/docs/helloworld/helloworld /helloworld

# Configure and document the service HTTP port.
# Service must listen to $PORT environment variable.
# This default value facilitates local development.
ENV PORT 8080
EXPOSE $PORT

# Run the web service on container startup.
CMD ["/helloworld"]
4 changes: 2 additions & 2 deletions serving/samples/helloworld-go/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,9 @@ recreate the source files from this folder.
# Copy the binary to the production image from the builder stage.
COPY --from=builder /go/src/github.com/knative/docs/helloworld/helloworld /helloworld

# Configure and document the service HTTP port.
# Service must listen to $PORT environment variable.
# This default value facilitates local development.
ENV PORT 8080
EXPOSE $PORT

# Run the web service on container startup.
CMD ["/helloworld"]
Expand Down
4 changes: 2 additions & 2 deletions serving/samples/helloworld-haskell/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ FROM fpco/haskell-scratch:integer-gmp
WORKDIR /root/
COPY --from=builder /root/.local/bin/helloworld-haskell-exe .

# Configure and document the service HTTP port.
# Service must listen to $PORT environment variable.
# This default value facilitates local development.
ENV PORT 8080
EXPOSE $PORT

# Run the web service on container startup.
CMD ["./helloworld-haskell-exe"]
56 changes: 28 additions & 28 deletions serving/samples/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 .

# Configure and document the service HTTP port.
ENV PORT 8080
EXPOSE $PORT

# 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
5 changes: 2 additions & 3 deletions serving/samples/helloworld-java/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,9 @@ FROM openjdk:8-jre-alpine
# Copy the jar to the production image from the builder stage.
COPY --from=builder /app/target/helloworld-*.jar /helloworld.jar

# Configure and document the service HTTP port.
# Service must listen to $PORT environment variable.
# This default value facilitates local development.
ENV PORT 8080
EXPOSE $PORT

# Run the web service on container startup.
CMD ["java","-Djava.security.egd=file:/dev/./urandom","-Dserver.port=${PORT}","-jar","/helloworld.jar"]

56 changes: 28 additions & 28 deletions serving/samples/helloworld-java/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,34 +86,34 @@ recreate the source files from this folder.
For additional information on multi-stage docker builds for Java see
[Creating Smaller Java Image using Docker Multi-stage Build](http://blog.arungupta.me/smaller-java-image-docker-multi-stage-build/).

```docker
# Use the official maven/Java 8 image to create a build artifact.
# https://hub.docker.com/_/maven
FROM maven:3.5-jdk-8-alpine as builder

# Copy local code to the container image.
WORKDIR /app
COPY pom.xml .
COPY src ./src

# Build a release artifact.
RUN mvn package -DskipTests

# Use the Official OpenJDK image for a lean production stage of our multi-stage build.
# https://hub.docker.com/_/openjdk
# https://docs.docker.com/develop/develop-images/multistage-build/#use-multi-stage-builds
FROM openjdk:8-jre-alpine

# Copy the jar to the production image from the builder stage.
COPY --from=builder /app/target/helloworld-*.jar /helloworld.jar

# Configure and document the service HTTP port.
ENV PORT 8080
EXPOSE $PORT

# Run the web service on container startup.
CMD ["java","-Djava.security.egd=file:/dev/./urandom","-Dserver.port=${PORT}","-jar","/helloworld.jar"]
```
```docker
# Use the official maven/Java 8 image to create a build artifact.
# https://hub.docker.com/_/maven
FROM maven:3.5-jdk-8-alpine as builder

# Copy local code to the container image.
WORKDIR /app
COPY pom.xml .
COPY src ./src

# Build a release artifact.
RUN mvn package -DskipTests

# Use the Official OpenJDK image for a lean production stage of our multi-stage build.
# https://hub.docker.com/_/openjdk
# https://docs.docker.com/develop/develop-images/multistage-build/#use-multi-stage-builds
FROM openjdk:8-jre-alpine

# Copy the jar to the production image from the builder stage.
COPY --from=builder /app/target/helloworld-*.jar /helloworld.jar

# 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","-Djava.security.egd=file:/dev/./urandom","-Dserver.port=${PORT}","-jar","/helloworld.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
4 changes: 2 additions & 2 deletions serving/samples/helloworld-kotlin/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ FROM openjdk:8-jre-alpine
# Copy the jar to the production image from the builder stage.
COPY --from=builder /home/gradle/build/libs/gradle.jar /helloworld.jar

# Configure and document the service HTTP port.
# Service must listen to $PORT environment variable.
# This default value facilitates local development.
ENV PORT 8080
EXPOSE $PORT

# Run the web service on container startup.
CMD [ "java", "-jar", "-Djava.security.egd=file:/dev/./urandom", "/helloworld.jar" ]
Loading