Simple flask hello world service to be deployed on a kubernetes cluster on Arm
607
Directory:
pi@master0:~/flask $ ls
Dockerfile hello_world.py requirements.txt
Docker file:
FROM resin/raspberry-pi-alpine-python:latest
MAINTAINER Dimitris Misdanitis "[email protected]"
LABEL vendor="Dimitris Misdanitis"
LABEL version="0.1"
LABEL release-date="2018-06-03"
COPY . /app
WORKDIR /app
RUN pip install -r requirements.txt
EXPOSE 5000
CMD python ./hello_world.py
hello_world.py
import os
from flask import Flask
app = Flask(__name__)
@app.route("/")
def hello():
host=os.environ["HOSTNAME"]
return "Hello World, Host: %s"%host
if __name__ == "__main__":
app.run(host='0.0.0.0', port=5000,debug=True)
requirements.txt
flask
Build
docker build --tag dmisdani/helloworld_k8s:arm -f Dockerfile .
create a file /tmp/hostname with the host name Run
docker run --name hello-world -p 5000:5000 -e "HOSTNAME="/tmp/hostname" dmisdani/helloworld_k8s:arm
Content type
Image
Digest
Size
151.5 MB
Last updated
about 8 years ago
docker pull dmisdani/helloworld_k8s:v0.3_arm