gpt4 book ai didi

docker - 运行时Docker镜像错误:找不到文件

转载 作者:行者123 更新时间:2023-12-02 19:26:54 25 4
gpt4 key购买 nike

FROM python:3.5 AS python-build
#ADDING WHOLE CODE TO FOLDER sequentialbot
ADD . /sequentialbot
#sequentialbot as WORKDIR
WORKDIR /sequentialbot
#INSTALLING PYTHON DEPENDENCY
RUN pip install -r requirements.txt

#FOR NODE MODULE
FROM node:11.10.0-alpine
#INSTALLING PYTHON HERE SOME PYTHON DEPENCY CAN ONLY INSTALL BY python:3.5 getting error in alpine,stretch etc
RUN apk add --update --no-cache \
python3-dev \
make \
g++
#COPY PYTHON DEPENDENCY FROM BASE
COPY --from=python-build /root/.cache /root/.cache
ADD . /sequentialbot
#NODE INSTALL
RUN npm install -g npm@latest
RUN npm cache verify
WORKDIR /sequentialbot/app/static
RUN npm install
RUN npm install sass -g
#SASS
RUN sass --no-source-map scss/layout/_header.scss:css/layout/_header.css
RUN sass --no-source-map scss/layout/_footer.scss:css/layout/_footer.css
RUN sass --no-source-map scss/layout/_side_menu.scss:css/layout/_side_menu.css
RUN sass --no-source-map scss/layout/_error_component.scss:css/layout/_error_component.css
RUN sass --no-source-map scss/components/_input_box.scss:css/components/_input_box.css
RUN sass --no-source-map scss/components/_button.scss:css/components/_button.css
RUN sass --no-source-map scss/components/_loading_mask.scss:css/components/_loading_mask.css
RUN sass --no-source-map scss/components/_template_card.scss:css/components/_template_card.css
RUN sass --no-source-map scss/pages/_onboarding_app.scss:css/pages/_onboarding_app.css
RUN sass --no-source-map scss/pages/_choose.scss:css/pages/_choose.css
RUN sass --no-source-map scss/pages/_adapt.scss:css/pages/_adapt.css
RUN sass --no-source-map scss/pages/_express.scss:css/pages/_express.css
RUN sass --no-source-map scss/pages/_experience.scss:css/pages/_experience.css
RUN sass --no-source-map scss/pages/_features.scss:css/pages/_features.css
RUN sass --no-source-map scss/pages/_request_demo.scss:css/pages/_request_demo.css
#bundle build
RUN npm run build
#SERVER.JS in node-src folder
WORKDIR /sequentialbot/node-src
EXPOSE 3000
ENTRYPOINT ["node", "server.js"]
#run.py inside sequentialbot folder
WORKDIR /sequentialbot
EXPOSE 9595
ENTRYPOINT [ "python3", "./run.py" ]

我已经写了这个docker文件来构建我的applicatio.my应用程序在python:3.5和node中。

使用以下文件创建使用此文件的docker镜像后,使用以下命令: docker run <image name>未指定端口或其他仅用于检查输出的内容

所以给我这样的错误:

python3: can't open file './run.py': [Errno 2] No such file or directory



我知道一些路径问题,但可以建议一些路径工作方式或可以共享一些引用 docker 文件。

最佳答案

您可以将ENTRYPOINT更改为此:

ENTRYPOINT [ "python3", "/sequentialbot/run.py" ]

据我所知,WORKDIR对于在构建期间运行的命令有效。 ENTRYPOINT命令作为容器启动的一部分运行。

关于docker - 运行时Docker镜像错误:找不到文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55496080/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com