Reputation: 37
I'm trying to access to my Api rest that I released in Heroku with docker and see that Dynos is running the gunicorn command that I put in the Dockerfile. The Dockerfile that I used is:
FROM ubuntu:18.04
RUN apt update
RUN apt install -y python3 python3-pip
RUN mkdir /opt/app
ENV PYTHONUNBUFFERED 1
ENV LANG C.UTF-8
ENV DEBIAN_FRONTEND=noninteractive
COPY Ski4All/ /opt/app/
COPY requirements.txt /opt/app/
RUN pip3 install -r /opt/app/requirements.txt
ENV PORT=8000
CMD exec gunicorn Ski4All.wsgi:application — bind 0.0.0.0:$PORT
When I release I go into the container via heroku run bash -a "name app"
and executing ps aux
I don't see the api running. But if execute the command of my Dockerfile when I'm in the container.
Any idea?
Upvotes: 1
Views: 195
Reputation: 1623
@jhaos mentioned gunicorn was running in the root path
Change the following in Dockerfile
RUN mkdir /opt/app to WORKDIR /opt/app
COPY Ski4All/ /opt/app/ to COPY Ski4All .
Upvotes: 2
Reputation: 37
The problem was that the gunicorn command was running in the / root path and not in the correct workdir. In the comments @HariHaraSuhan solved the error.
Upvotes: 0