如何解决当出现消息“在http://0.0.0.0:5000/上运行按CTRL + C退出”时,如何继续我的代码船构建
使用代码构建我的flask应用程序。执行codeship-steps.yml
并显示消息时,构建卡住了
(service: app) (step: build) * Running on http://0.0.0.0:5000/ (Press CTRL+C to quit)
APP代码:
__main__.py templates web.py
index.html
位于templates
来自web.py
的代码
app = Flask(__name__)
@app.route("/")
def home():
return render_template("index.html")
来自__main__.py
的代码
if __name__ == "__main__":
app.run(host='0.0.0.0')
index.html
<h1>Hello</h1>
codeship-services.yml
文件步骤
app:
build:
image: id/pythonapp
dockerfile: Dockerfile
args:
build_env: production
cached: true
codeship-steps.yml
文件步骤:
- name: build
service: app
command: build-command
- name: test
service: app
tag: master
command: test-command
- name: publish
service: app
type: push
image_name: id/repo
registry: https://index.docker.io/v1/
encrypted_dockercfg_path: dockercfg.encrypted
Dockerfile
内容:
FROM python:3.8-alpine
workdir /task/devops
ENV PATH="/task/devops:${PATH}"
copY . .
RUN mv secret.txt /var/secret.txt
RUN pip install -r requirements.txt
CMD [ "task-devops" ] ## task-devops is a file
task-devops
的内容:
#! /bin/sh
function help_menu {
cat README.md
}
function tasks_display {
cat TASKS.md
}
function unit_tests {
py.test tests/*
}
function serve {
python app/
}
if [[ $# -eq 0 ]] ; then
help_menu
exit 0
fi
case "$1" in
help) help_menu & ;;
test) unit_tests & ;;
serve) serve & ;;
tasks) tasks_display & ;;
x) cat /var/secret.txt & ;;
*) help_menu &;;
esac
child=$!
wait "$child"
#2> /dev/null
从日志中注意到,docker Image
创建成功。但是我的应用程序卡住了。如何继续进行构建?
(image: id/pythonapp) (service: app) ---> 21b899ba45a3
(image: id/pythonapp) (service: app) [Warning] One or more build-args [build_env] were not consumed
(image: id/pythonapp) (service: app) Successfully built 21b899ba45a3
(image: id/pythonapp) (service: app) Successfully tagged id/pythonapp:latest
(service: app) (step: build) * Serving Flask app "web" (lazy loading)
(service: app) (step: build) * Environment: production
WARNING: This is a development server. Do not use it in a production deployment.
Use a production Wsgi server instead.
(service: app) (step: build) * Debug mode: off
(service: app) (step: build) * Running on http://0.0.0.0:5000/ (Press CTRL+C to quit)
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。