I have created a flask app and it is running fine locally using this command
gunicorn --workers 2 -b :5000 wsgi:app
Now I'm trying to run the same application in docker and I'm getting ./gunicorn_starter.sh: line 3: gunicorn: command not found
.
my dockerfile:
FROM python:3.5
WORKDIR /app
COPY requirements.txt requirements.txt
RUN pip3 install -r requirements.txt --user
COPY . .
RUN chmod +x gunicorn_starter.sh
CMD ["./gunicorn_starter.sh" ]
gunicorn_starter.sh:
#!/bin/sh
source venv/bin/activate
gunicorn --workers 2 -b :5000 wsgi:app
wsgi.py:
from app import app
if __name__ == "__main__":
app.run(debug=True)
File structure:
flask_app
>venv
dockerfile
gunicorn_starter.sh
app.py
wsgi.py
requirements.txt
I do have gunicorn in requiremnets.txt file.
I have tried following links:
gunicorn not found when running a docker container with venv
Installed gunicorn but it is not in venv/bin folder
Gunicorn throwing error - cannot find executable on $PATH (Docker/Nginx)
I couldn't figure out why it is not working, please help Thanks.