I have the following dockerfile:
FROM python:3.12.0-alpine3.18
WORKDIR /usr/src/app
ENV PYTHONDONTWRITEBYTECODE 1
ENV PYTHONUNBUFFERED 1
RUN apk update && \
apk add --virtual build-deps gcc python3-dev musl-dev && \
apk add postgresql-dev
COPY requirements ./requirements
RUN pip install -r ./requirements/local.txt
COPY . .
EXPOSE 8000
Here is my requirements.txt:
Django==4.2.7
psycopg==3.1.13
The following error occurs when the image is loaded:
ERROR: failed to solve: process "/bin/sh -c pip install -r ./requirements/local.txt" did not complete successfully: exit code: 1
I tried to install various dependencies in my dockerfile. But always the same error.
What dependencies do I need to add to my dockerfile for psycopg to install? And also where can you read what dependencies you need to add and your dockerfile for certain libraries based on a certain image?
There seem to be some inconsistencies in the paths used in your
Dockerfile. Please try the following using your currentrequirements.txt:Below you can see the image builds successfully and you can load both packages in Python.