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" ]
Content type
Image
Digest
Size
339.3 MB
Last updated
over 4 years ago
docker pull liujian82/echo-hostname