如何解决docker部署上的gunicorn错误(heroku)

时间:2019-05-11 21:36:25

标签: heroku flask dockerfile

我使用heroku container:push web -a APPNAME将Flask应用程序推送到了Heroku。我遵循了Container Registry & Runtime中概述的步骤,但是在尝试打开应用程序并检查日志时收到此错误。

Starting process with command `/bin/sh -c gunicorn\ --bind\ 0.0.0.0:\28781\ run`
2019-05-11T21:21:25.203158+00:00 heroku[web.1]: State changed from starting to crashed
2019-05-11T21:21:25.149101+00:00 app[web.1]: /bin/sh: 1: gunicorn: not found
2019-05-11T21:21:25.188125+00:00 heroku[web.1]: Process exited with status 127

我在我的requirements.txt文件中添加了gunicorn,也尝试在dockerfile中进行apt-get install gunicorn。我需要在python环境中打电话给gunicorn吗?我究竟做错了什么?这是我第一次使用heroku和docker。一些帮助将不胜感激。我的dockerfile是这样的:

FROM ubuntu:16.04

ADD ./chemITry/requirements.txt /tmp/requirements.txt
RUN apt-get update && \
    apt-get install -y software-properties-common vim && \
    add-apt-repository ppa:jonathonf/python-3.6 

RUN apt-get update -y

RUN DEBIAN_FRONTEND=noninteractive apt-get -y install mysql-server python-mysqldb && \
    apt-get install libmysqlclient-dev -y

RUN apt-get install -y build-essential python3.6 python3.6-dev python3-pip python3.6-venv && \
    apt-get install -y gunicorn 
RUN python3.6 -m pip install pip --upgrade && \
        python3.6 -m pip install wheel

RUN pip install -r /tmp/requirements.txt

ADD ./chemITry /opt/chemITry/
WORKDIR /opt/chemITry
COPY ./chemITry/cmd.sh /cmd.sh
RUN chmod +x /cmd.sh
CMD cmd.sh

FROM heroku/miniconda
RUN conda install -c openbabel openbabel 

FROM ubuntu:16.04
RUN useradd -m username
USER username

CMD gunicorn --bind 0.0.0.0:$PORT run 

0 个答案:

没有答案