mirror of https://github.com/knative/docs.git
Remove PORT environment variable from helloworld Dockerfiles (#1019)
This commit is contained in:
parent
4984038306
commit
87c844b70d
docs/serving/samples
hello-world
helloworld-csharp
helloworld-go
helloworld-java
helloworld-kotlin
helloworld-nodejs
helloworld-php
helloworld-python
helloworld-ruby
helloworld-python
|
@ -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"]
|
||||
|
|
|
@ -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"]
|
||||
```
|
||||
|
|
|
@ -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"]
|
||||
|
|
|
@ -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"]
|
||||
```
|
||||
|
|
|
@ -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"]
|
||||
|
|
|
@ -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"]
|
||||
```
|
||||
|
|
|
@ -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" ]
|
||||
|
|
|
@ -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" ]
|
||||
```
|
||||
|
|
|
@ -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" ]
|
||||
|
|
|
@ -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" ]
|
||||
```
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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"]
|
||||
|
|
|
@ -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"]
|
||||
```
|
||||
|
|
|
@ -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
|
Loading…
Reference in New Issue