Remove PORT environment variable from helloworld Dockerfiles ()

This commit is contained in:
Adam Ross 2019-03-21 09:39:49 -07:00 committed by Knative Prow Robot
parent 4984038306
commit 87c844b70d
17 changed files with 29 additions and 69 deletions
docs/serving/samples
hello-world
helloworld-csharp
helloworld-go
helloworld-java
helloworld-kotlin
helloworld-nodejs
helloworld-php
helloworld-python
helloworld-ruby
helloworld-python

View File

@ -14,9 +14,5 @@ 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"]

View File

@ -78,10 +78,6 @@ recreate the source files from this folder.
# 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"]
```

View File

@ -19,9 +19,5 @@ 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
# 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"]

View File

@ -79,10 +79,6 @@ 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
# 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"]
```

View File

@ -18,9 +18,5 @@ 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"]

View File

@ -106,10 +106,6 @@ recreate the source files from this folder.
# 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"]
```

View File

@ -17,9 +17,5 @@ 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
# 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", "-Djava.security.egd=file:/dev/./urandom", "/helloworld.jar" ]

View File

@ -127,10 +127,6 @@ recreate the source files from this folder.
# Copy the jar to the production image from the builder stage.
COPY --from=builder /home/gradle/build/libs/gradle.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", "-jar", "-Djava.security.egd=file:/dev/./urandom", "/helloworld.jar" ]
```

View File

@ -16,9 +16,5 @@ RUN npm install --only=production
# Copy local code to the container image.
COPY . .
# Service must listen to $PORT environment variable.
# This default value facilitates local development.
ENV PORT 8080
# Run the web service on container startup.
CMD [ "npm", "start" ]

View File

@ -103,10 +103,6 @@ recreate the source files from this folder.
# Copy local code to the container image.
COPY . .
# Service must listen to $PORT environment variable.
# This default value facilitates local development.
ENV PORT 8080
# Run the web service on container startup.
CMD [ "npm", "start" ]
```

View File

@ -14,6 +14,3 @@ RUN sed -i 's/80/${PORT}/g' /etc/apache2/sites-available/000-default.conf /etc/a
# https://hub.docker.com/_/php#configuration
RUN mv "$PHP_INI_DIR/php.ini-development" "$PHP_INI_DIR/php.ini"
# Service must listen to $PORT environment variable.
# This default value facilitates local development.
ENV PORT 8080

View File

@ -51,10 +51,6 @@ recreate the source files from this folder.
# RUN mv "$PHP_INI_DIR/php.ini-production" "$PHP_INI_DIR/php.ini"
# https://hub.docker.com/_/php#configuration
RUN mv "$PHP_INI_DIR/php.ini-development" "$PHP_INI_DIR/php.ini"
# Service must listen to $PORT environment variable.
# This default value facilitates local development.
ENV PORT 8080
```
1. Create a new file, `service.yaml` and copy the following service definition

View File

@ -8,11 +8,10 @@ WORKDIR $APP_HOME
COPY . .
# Install production dependencies.
RUN pip install Flask
RUN pip install Flask gunicorn
# Service must listen to $PORT environment variable.
# This default value facilitates local development.
ENV PORT 8080
# Run the web service on container startup.
CMD ["python", "app.py"]
# Run the web service on container startup. Here we use the gunicorn
# webserver, with one worker process and 8 threads.
# For environments with multiple CPU cores, increase the number of workers
# to be equal to the cores available.
CMD exec gunicorn --bind :$PORT --workers 1 --threads 8 app:app

View File

@ -57,14 +57,13 @@ recreate the source files from this folder.
COPY . .
# Install production dependencies.
RUN pip install Flask
RUN pip install Flask gunicorn
# Service must listen to $PORT environment variable.
# This default value facilitates local development.
ENV PORT 8080
# Run the web service on container startup.
CMD ["python", "app.py"]
# Run the web service on container startup. Here we use the gunicorn
# webserver, with one worker process and 8 threads.
# For environments with multiple CPU cores, increase the number of workers
# to be equal to the cores available.
CMD exec gunicorn --bind :$PORT --workers 1 --threads 8 app:app
```
1. Create a new file, `service.yaml` and copy the following service definition

View File

@ -11,9 +11,5 @@ RUN bundle install
# Copy local code to the container image.
COPY . .
# Service must listen to $PORT environment variable.
# This default value facilitates local development.
ENV PORT 8080
# Run the web service on container startup.
CMD ["ruby", "./app.rb"]

View File

@ -55,10 +55,6 @@ recreate the source files from this folder.
# Copy local code to the container image.
COPY . .
# Service must listen to $PORT environment variable.
# This default value facilitates local development.
ENV PORT 8080
# Run the web service on container startup.
CMD ["ruby", "./app.rb"]
```

View File

@ -0,0 +1,17 @@
# Use the official Python image.
# https://hub.docker.com/_/python
FROM python
# Copy local code to the container image.
ENV APP_HOME /app
WORKDIR $APP_HOME
COPY . .
# Install production dependencies.
RUN pip install Flask gunicorn
# Run the web service on container startup. Here we use the gunicorn
# webserver, with one worker process and 8 threads.
# For environments with multiple CPU cores, increase the number of workers
# to be equal to the cores available.
CMD exec gunicorn --bind :$PORT --workers 1 --threads 8 app:app