使用烧瓶执行bash脚本+ docker

发布于 2025-02-06 03:15:49 字数 658 浏览 2 评论 0原文

我一直在尝试创建一个执行简单shell脚本的烧瓶API(例如session = popen(['echo server_info.js' ,stderr =管道)。 另外,我将摇摇欲坠和蓝图用于烧瓶。 Dockerized版本显示了Swagger,但不会更新我在Swagger.json文件中所做的任何更改(代码:

SWAGGER_URL = '/swagger'
API_URL = '/static/swagger.json'
SWAGGERUI_BLUEPRINT = get_swaggerui_blueprint(
    SWAGGER_URL,
    API_URL,
    config={
        'app_name': "NAME"
    }
))

docker文件代码:

FROM python:3.7

RUN mkdir /usr/src/app

WORKDIR /usr/src/app

COPY . /usr/src/app

RUN pip3 install --trusted-host pypi.python.org -r requirements.txt

EXPOSE 5000

ENTRYPOINT ["python3", "/usr/src/app/app.py"]

是否有建议?

I've been trying to create a FLASK api that executes simple shell scripts (e.g session = Popen(['echo server_info.js" | node {}'.format(cmd)],shell=True, stdout=PIPE, stderr=PIPE). This worked very well but when i dockerized the application, the script stopped running and returned this error: b'/bin/sh: 1: /path No such file or directory.
Also, I use swagger and blueprint for the FLASK. the dockerized version shows the swagger but does not update any change I make in the swagger.json file (the code:

SWAGGER_URL = '/swagger'
API_URL = '/static/swagger.json'
SWAGGERUI_BLUEPRINT = get_swaggerui_blueprint(
    SWAGGER_URL,
    API_URL,
    config={
        'app_name': "NAME"
    }
))

Also the docker file code:

FROM python:3.7

RUN mkdir /usr/src/app

WORKDIR /usr/src/app

COPY . /usr/src/app

RUN pip3 install --trusted-host pypi.python.org -r requirements.txt

EXPOSE 5000

ENTRYPOINT ["python3", "/usr/src/app/app.py"]

Any suggestion?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文