Failed to solve: process "/bin/sh -c pip install -r requirements.txt" did not complete successfully: exit code: 1

I am using this Dockerfile for my Django + React(Vite) application. Its giving the same error every time when I am running it with docker-compose build

GitHub: click here

Dockerfile (Django)

FROM  python:3.10-slim

ENV PYTHONUNBUFFERED=1
ENV EMAIL_HOST_USER=email
ENV EMAIL_HOST_PASSWORD=password

WORKDIR /backend

RUN apt-get update && apt-get install -y libpq-dev build-essential

RUN pip install -r requirements.txt

COPY . . 

EXPOSE 8000

Dockerfile (React)

FROM node:20.6-buster-slim

WORKDIR /frontend

COPY . .

RUN npm install

EXPOSE 5173

CMD ["npm", "run", "dev"]

docker-compose.yml

services:
  backend:
    build: ./backend        
    ports:
      - "8000:8000"
    volumes:
      - ./backend:/backend
    command: bash -c "python manage.py makemigrations && python manage.py migrate && python manage.py runserver 0.0.0.0:8000"

  frontend:
    build: ./frontend
    ports:
      - "5173:5173"
    volumes:
      - ./frontend:/frontend

I would appreciate if anyone can help me with solving the issue and make the build successful with dockerizing the whole application.

Back to Top