1

i am trying to use docker in my django project, i am new to using docker and i do not really know where the error is coming from.

This is how my Dockerfile looks:

FROM python:3.8.13-slim-buster
WORKDIR /app
COPY ./my_app ./

RUN pip install --upgrade pip --no-cache-dir

RUN pip install psycopg2 --no-cache-dir
RUN apk del build-deps --no-cache-dir
RUN pip install -r /app/requirements.txt --no-cache-dir

RUN \
    apk add --no-cache postgresql-libs && \
    apk add --no-cache --virtual .build-deps gcc musl-dev postgresql-dev && \
    python3 -m pip install -r requirements.txt --no-cache-dir && \
    apk --purge del .build-deps

CMD ["python3", "manage.py", "runserver", "0.0.0.0:8000"]
# CMD ["gunicorn", "main_app.wsgi:application", "--bind"]
  • have you tried adding it to PATH? –  Aug 18 '22 at 23:16
  • how do i add it to path? i didn't install any exe file, i used pip to install pyscopg2 – Destiny Franks Aug 18 '22 at 23:17
  • You need to install the relevant OS package (in a Debian-based Python image, `RUN apt-get install libpq-dev`) before you `RUN pip install`. The linked question is the canonical Python question on the topic. – David Maze Aug 18 '22 at 23:49

0 Answers0