我在我的项目中使用docker。最初在Pipfile中有以下软件包
[packages]
django = "*"
djangorestframework = "*"
celery = "*"
whitenoise = "*"
redis = "*"
django-celery-beat = "*"
flower = "*"
django-environ = "*"
django-redis = "*"
"flake8" = "*"
coverage = "*"
gunicorn = "*"
sentry-sdk = "*"
django-storages = {extras = ["boto3"], version = "*"}
django-anymail = {extras = ["mailgun"], version = "*"}
pillow = "*"
"psycopg2-binary" = "*"
django-money = "*"
django-phonenumber-field = "*"
phonenumbers = "*"
"argon2-cffi" = "*"
jsonfield = "*"
future = "*"
django-contrib-comments = "*"
tzlocal = "*"
[dev-packages]
werkzeug = "*"
"autopep8" = "*"
"flake8" = "*"
然后我构建我的项目,它运行良好。但是在构建映像后不久,我使用
在本地环境中安装了以下软件包pipenv install pylint-django pylint-celery django-debug-toolbar django-extensions --dev
现在我已经更新了软件包列表,我尝试使用docker-compose -f local.yml build
重建映像,我猜没有安装那些软件包,所以我遇到了问题`ModuleNotFoundError:没有名为'debug_toolbar'的模块。
这是我的docker配置
FROM python:3.6-alpine
ENV PYTHONUNBUFFERED 1
RUN apk update \
# psycopg2 dependencies
&& apk add --virtual build-deps gcc python3-dev musl-dev \
&& apk add postgresql-dev \
# Pillow dependencies
&& apk add jpeg-dev zlib-dev freetype-dev lcms2-dev openjpeg-dev tiff-dev tk-dev tcl-dev \
# CFFI dependencies
&& apk add libffi-dev py-cffi \
# Translations dependencies
&& apk add gettext \
# https://docs.djangoproject.com/en/dev/ref/django-admin/#dbshell
&& apk add postgresql-client
RUN pip3 install -U pip pipenv
COPY Pipfile* /app/
WORKDIR /app
RUN pipenv install --deploy --system --ignore-pipfile
COPY ./compose/production/django/entrypoint /entrypoint
RUN sed -i 's/\r$//g' /entrypoint
RUN chmod +x /entrypoint
COPY ./compose/local/django/start /start
RUN sed -i 's/\r$//g' /start
RUN chmod +x /start
COPY ./compose/local/django/celery/worker/start /start-celeryworker
RUN sed -i 's/\r$//g' /start-celeryworker
RUN chmod +x /start-celeryworker
COPY ./compose/local/django/celery/beat/start /start-celerybeat
RUN sed -i 's/\r$//g' /start-celerybeat
RUN chmod +x /start-celerybeat
COPY ./compose/local/django/celery/flower/start /start-flower
RUN sed -i 's/\r$//g' /start-flower
RUN chmod +x /start-flower
WORKDIR /app
ENTRYPOINT ["/entrypoint"]
为什么在已经生成映像后不安装Pipfile中的新软件包?