0% found this document useful (0 votes)
20 views

Pythonapp Docker

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
20 views

Pythonapp Docker

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 1

FROM python:3.

8-alpine

# 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 ["app.py" ]

->app.py

from flask import Flask


import os
app = Flask(__name__)

@app.route('/')
def hello_geek():
return '<h1>Hello from Flask & Docker</h1>'
@app.route('/hi')
def hell():
return '<h1>Hiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii from Flask & Docker</h1>'

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

->requirements.txt

click==8.0.3
colorama==0.4.4
Flask==2.0.2
itsdangerous==2.0.1
Jinja2==3.0.3
MarkupSafe==2.0.1
Werkzeug==2.0.2
gunicorn==20.1.0

You might also like