Open dantagg opened 2 years ago
instead of git-all
, how about just git
? I also install git in my Dockerfile and it works
ARG PYTHON_VERSION=3.9-slim-bullseye
# define an alias for the specfic python version used in this file.
FROM python:${PYTHON_VERSION} as python
# Python build stage
FROM python as python-build-stage
RUN echo "deb http://deb.debian.org/debian bullseye main" > /etc/apt/sources.list
ARG BUILD_ENVIRONMENT=local
# Install apt packages
RUN apt-get update && apt-get install --no-install-recommends -y \
# dependencies for building Python packages
build-essential curl vim wget git ####### HERE #######
and in requirements/base.py
...
celery==5.2.6 # pyup: < 6.0 # https://github.com/celery/celery
-e git+https://github.com/llazzaro/django-scheduler.git@develop#egg=django-scheduler ### THIS ###
django-celery-beat==2.2.1 # https://github.com/celery/django-celery-beat
...
@xjlin0
Another option is not to use git (and ssh git clone) at all:
The latest version of pip
supports this syntax:
<NAME-OF-THE-PACKAGE>@<FULL-URL-TO-THE-COMPRESSED-PYTHON-PACKAGE>.<tar.gz-or-zip>
For GitHub, it can be translated to:
<NAME-OF-THE-PACKAGE>@https://github.com/<USER>/<REPOSITORY-NAME>/archive/<BRANCH_NAME_OR_COMMIT_HASH>.<tar.gz-or-zip>
Sample:
celery==5.2.6 # pyup: < 6.0 # https://github.com/celery/celery
django-schedule@https://github.com/llazzaro/django-scheduler/archive/develop.tar.gz ### THIS ###
django-celery-beat==2.2.1 # https://github.com/celery/django-celery-beat
This is an old issue but I encountered the same error. Turns out I forgot to update local/docs/Dockerfile. By looking at the error message, it seems the author of the issue also forgot it. If anyone encounters this issue, make sure to update all Dockerfiles.
What happened?
I updated local django Dockerfile
python-build-stage
to includeand updated
python-run-stage
to includeI did this because one of my pip requirements needs git to install, for example
It isn't this, but the one I'm installing is in a private repository.
When I run
docker compose -f local.yml build
it fails with the following error
ERROR: Cannot find command 'git' - do you have 'git' installed and in your PATH?
Looking at the build log, there is an error
and then further down there is
This suggests the pip install is running ahead and being attempted before the apt-get installs have finished and the when pip fails, the APT-GET is cancelled because the whole build has borked.
What should've happened instead?
The build should have completed successfully
Additional details
Host system configuration:
Cookiecutter 1.7.3
ProductName: macOS ProductVersion: 11.6.4 BuildVersion: 20G417 Docker Compose version v2.3.3 Docker version 20.10.13, build a224086 Python on host: Python 3.10.0 (v3.10.0:b494f5935c Python on Docker: Python 3.9.12 (main, Mar 29 2022, 14:20:48) [GCC 10.2.1 20210110] on linux
python3 -V
:docker --version
:docker-compose --version
:Options selected and/or replay file: On Linux and MacOS:
cat ${HOME}/.cookiecutter_replay/cookiecutter-django.json
(Please, take care to remove sensitive information)