Create a Dockerfile for a Python Flask application

preview_player
Показать описание
Dockerfile
===========
# Use an official Python runtime as the base image
FROM python:3.9-slim

# Set the working directory in the container
WORKDIR /app

# Copy the current directory contents into the container at /app
COPY . .

# Make port 5000 available to the world outside this container
EXPOSE 5000

# Define environment variable

CMD ["flask", "run", "--host=0.0.0.0"]

=============================
python
from flask import Flask

app = Flask(__name__)

def hello():
return 'Hello, welcome to my Flask app!'

if __name__ == '__main__':

This simple Flask application defines a single route `/` that returns a greeting message.

======================

Flask==2.0.2

#dockertraining #dockertutorial #preethidevops
Рекомендации по теме
visit shbcf.ru