Code: Select all
FROM python:3.11.11-alpine3.21
# Install packages (acc. to instructions
# https://github.com/gliderlabs/docker-alpine/blob/master/docs/usage.md)
RUN apk --no-cache add curl ca-certificates sqlite git
WORKDIR /app
COPY setup.py .
COPY pyproject.toml .
# Install `uv` acc. to the instructions
# https://docs.astral.sh/uv/guides/integration/docker/#installing-uv
ADD https://astral.sh/uv/0.5.29/install.sh /uv-installer.sh
RUN sh /uv-installer.sh && rm /uv-installer.sh
ENV PATH="/root/.local/bin/:$PATH"
# Install packages with uv into system python
RUN uv pip install --system -e .
# Expose the Django port
EXPOSE 8000
RUN git config --global --add safe.directory /app
< /code>
Jetzt habe ich die folgende Struktur: < /p>
django-polls-v2/
- dist/
- .gitignore
- django_polls_v2-0.0.1-py3-none-any.whl
- django_polls_v2-0.0.1.tar.gz
- django_polls_v2/
- migrations/
- ...
- static/
- ...
- templates/
- ...
- __init__.py
- admin.py
- ...
- README.rst
- pyproject.toml
- MANIFEST.in
- LICENSE
< /code>
Um mein eigenes Paket zu installieren, vgl. Hier gibt es in der Dokumentation an, Folgendes auszuführen (wo ich die Dateinamen so angepasst habe, dass ich meine Einstellung widerspiegelt): < /p>
python -m pip install --user django-polls-v2/dist/django_polls_v2/0.0.1.tar.gz
< /code>
Nun, wenn ich diesen Befehl in einem laufenden Docker -Container ausführe (wo ich in den Docker -Container komme, indem ich
ausführtedocker run -p 8000:8000 --shm-size 512m --rm -v $(pwd):/app -it django:0.0.1 sh
1.670 Processing ./django-polls-v2/dist/django_polls_v2-0.0.1.tar.gz
1.671 ERROR: Could not install packages due to an OSError: [Errno 2] No such file or directory: '/app/django-polls-v2/dist/django_polls_v2-0.0.1.tar.gz'
< /code>
Da der Pfad korrekt ist, bin ich verblüfft darüber, warum der Fehler auftritt. Ich habe bereits versucht, einen Nicht-Root-Benutzer zu erstellen>