How to get pipenv running in docker?

后端 未结 3 1925
走了就别回头了
走了就别回头了 2020-12-12 15:11

Im installing pipenv in my docker:

RUN pip install pipenv
RUN cd /my/app/path/ && pipenv install
RUN cd /my/app/path/ && pipenv shell
         


        
3条回答
  •  伪装坚强ぢ
    2020-12-12 15:33

    Considering your problem, as I know it the easiest way is to update to the latest version of pipenv. It is still in development, so problems are fixed very soon.

    We are using pipenv with docker in production. And we really like it. There are several things to keep in mind:

    1. You need to use --system flag, so it will install all packages into the system python, and not into the virtualenv. Since docker containers do not need to have virtualenvs
    2. You need to use --deploy flag, so your build will fail if your Pipfile.lock is out of date
    3. You need to use --ignore-pipfile, so it won't mess with our setup

    Check the official docs to be sure that this information is up-to-date.

    All in all:

    pipenv install --system --deploy --ignore-pipfile
    

    There's also one more thing. If you are using the same Dockerfile for both development and production it would be very nice to also use --dev flag for the development environment only.

    Also, check out our django project template to see the full example: wemake-django-template

提交回复
热议问题