I am new to Docker and trying my best to figure out every bit, but seriously struggle on starting gunicorn and nginx with my Dockerfile. Whenever I add the last four lines, the container won't boot and also fails with no error message at all.
FROM python:3.9-buster EXPOSE 80 RUN apt update RUN apt upgrade RUN apt install nginx python3 python3-pip git swig python3-dev build-essential libmagic-dev -y RUN apt install ffmpeg -y RUN mkdir /opt/xxx RUN git clone https://xxx:[email protected]/xxx/backend.git /opt/xxx/ RUN mkdir /root/d12f RUN python3 -m pip install --upgrade pip COPY .env /opt/xxx/xxx/.env RUN pip3 install -r /opt/xxx/requirements.txt RUN pip3 install gunicorn RUN git clone https://xxx:[email protected]/xxx/configs.git /root/configs/ RUN cp /root/configs/nginx/default /etc/nginx/sites-available/. RUN mkdir /var/log/celery/ CMD /usr/sbin/nginx -c /etc/nginx/nginx.conf CMD /usr/local/bin/celery -A xxx --workdir /opt/xxx worker --loglevel=INFO -P prefork & CMD /usr/local/bin/celery -A xxx --workdir /opt/xxx beat --schedule=/tmp/celerybeat-schedule --loglevel=INFO CMD /usr/bin/gunicorn --chdir /opt/xxx --conf xxx:gunicorn_conf xxx:wsgi
The build works as expected but running with docker run -p 80:80 xxx:latest is not.