微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

当出现消息“在http://0.0.0.0:5000/上运行按CTRL + C退出”时,如何继续我的代码船构建

如何解决当出现消息“在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代码

应用程序代码位于包含三个文件的名为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 举报,一经查实,本站将立刻删除。

相关推荐


Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其他元素将获得点击?
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。)
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbcDriver发生异常。为什么?
这是用Java进行XML解析的最佳库。
Java的PriorityQueue的内置迭代器不会以任何特定顺序遍历数据结构。为什么?
如何在Java中聆听按键时移动图像。
Java“Program to an interface”。这是什么意思?