Не вставляйте модули внутрь контейнера
Решил развернуть тестовый проект и для этого купил vps сервер на ubuntu у reg ru. При сборке контейнеров возникает ошибка с пакетами pip внутри образа python:
> [backend 5/6] RUN pip install -r requirements.txt:
#0 15.76 WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ReadTimeoutError("HTTPSConnectionPool(host='pypi.org', port=443): Read timed out. (read timeout=15)")': /simple/asgiref/
#0 31.37 WARNING: Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ReadTimeoutError("HTTPSConnectionPool(host='pypi.org', port=443): Read timed out. (read timeout=15)")': /simple/asgiref/
#0 47.48 WARNING: Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ReadTimeoutError("HTTPSConnectionPool(host='pypi.org', port=443): Read timed out. (read timeout=15)")': /simple/asgiref/
#0 64.58 WARNING: Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ReadTimeoutError("HTTPSConnectionPool(host='pypi.org', port=443): Read timed out. (read timeout=15)")': /simple/asgiref/
#0 83.69 WARNING: Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ReadTimeoutError("HTTPSConnectionPool(host='pypi.org', port=443): Read timed out. (read timeout=15)")': /simple/asgiref/
#0 98.81 ERROR: Could not find a version that satisfies the requirement asgiref==3.7.2 (from versions: none)
#0 98.81 ERROR: No matching distribution found for asgiref==3.7.2
------
failed to solve: process "/bin/sh -c pip install -r requirements.txt" did not complete successfully: exit code: 1
root@cv3598657:/home/var/www/test_repo# client_loop: send disconnect: Broken pipe
сам код образа и docker-compose:
`FROM python:3.10-alpine3.19
WORKDIR /app
COPY ./requirements.txt ./
RUN pip install --upgrade pip
RUN pip install -r requirements.txt
COPY ./src ./src`
.
version: "3.9"
services:
backend:
restart: always
build:
context: ./backend
image: django-backend
command:
sh -c "cd ./src && python manage.py migrate && gunicorn --bind 0.0.0.0:8000 config.wsgi"
depends_on:
- postgresql-db
postgresql-db:
restart: always
image: postgres:14.6-alpine
env_file: ./postgresql-db/.pg-env
nginx:
restart: always
build:
context: ./nginx
ports:
- "8080:80"
- tried reinstalling docker
- tried changing the image itself