FROM python:3.7
COPY ./src /data/python
WORKDIR /data/python
RUN pip install --no-cache-dir flask
EXPOSE 8080
CMD ["python", "main.py"]
import os
from flask import Flask
app = Flask(__name__)
@app.route('/')
def index():
return {'body': os.environ.items()}
def run():
app.run(host='0.0.0.0', port=8080)
if __name__ == '__main__':
run()
click invoke result
[
"2021-01-29T09:53:30.727847Z stdout: * Serving Flask app "main" (lazy loading)",
"2021-01-29T09:53:30.727905Z stdout: * Environment: production",
"2021-01-29T09:53:30.727913Z stdout: WARNING: This is a development server. Do not use it in a production deployment.",
"2021-01-29T09:53:30.727918Z stdout: Use a production WSGI server instead.",
"2021-01-29T09:53:30.727923Z stdout: * Debug mode: off",
"2021-01-29T09:53:30.731130Z stderr: * Running on http://0.0.0.0:8080/ (Press CTRL+C to quit)",
"2021-01-29T09:53:30.747035Z stderr: 172.30.139.167 - - [29/Jan/2021 09:53:30] "u001b[33mPOST /init HTTP/1.1u001b[0m" 404 -",
"2021-01-29T09:53:30.748Z stderr: The action did not initialize or run as expected. Log data might be missing."
]
I've added the Docker container to IBM Cloud Functions
What would be the best way to approach this?
question from:
https://stackoverflow.com/questions/65952262/ibm-cloud-functions-how-to-run-a-docker-function 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…