Sign inSign up

liujian82/echo-hostname

By liujian82

Updated over 4 years ago

Image
0

121

liujian82/echo-hostname repository overview

from flask import Flask, render_template
import socket, os

app = Flask(__name__)
host_name = socket.gethostname()

@app.route('/')
def home():
    return host_name


if __name__ == "__main__":
    port = int(os.environ.get('PORT', 5000))
    app.run(debug=True, host='0.0.0.0', port=port)

Dockerfile

FROM python

# copy the requirements file into the image
COPY ./requirements.txt /app/requirements.txt

# switch working directory
WORKDIR /app

# install the dependencies and packages in the requirements file
RUN pip install -r requirements.txt

# copy every content from the local file to the image
COPY . /app

# configure the container to run in an executed manner
ENTRYPOINT [ "python" ]

CMD ["view.py" ]

Tag summary

Content type

Image

Digest

Size

339.3 MB

Last updated

over 4 years ago

docker pull liujian82/echo-hostname