how to run gunicorn on docker

后端 未结 6 451
南旧
南旧 2020-12-29 08:06

I have 2 files that depend on each other when docker is start up. 1 is a flask file and one is a file with a few functions. When docker starts, only the functions file will

6条回答
  •  生来不讨喜
    2020-12-29 08:50

    This work for me:

    FROM docker.io/python:3.7
    
    WORKDIR /app
    
    COPY requirements.txt ./
    
    RUN pip install --no-cache-dir -r requirements.txt
    
    ENV GUNICORN_CMD_ARGS="--bind=0.0.0.0 --chdir=./src/"
    COPY . .
    
    EXPOSE 8000
    
    CMD [ "gunicorn", "app:app" ]
    

提交回复
热议问题