Firstly, I add a lots of package in requirements.txt, docker build it and works better. and then I changed my requirements.txt like below.
Django==2.2.6
django-filter==2.4.0
djangorestframework==3.12.1
djongo==1.3.3
Pillow==8.0.0
pylint==2.6.0
requests==2.24.0
sqlparse==0.2.4
urllib3==1.25.11
but when I try docker-compose up again, pip still install other pacakge that I removed.
Step 8/22 : RUN pip install --no-cache-dir -r /requirements.txt
---> Running in 55fcc339ce74
Collecting Django==2.2.6
Downloading Django-2.2.6-py3-none-any.whl (7.5 MB)
Collecting django-filter==2.4.0
Downloading django_filter-2.4.0-py3-none-any.whl (73 kB)
Collecting djangorestframework==3.12.1
Downloading djangorestframework-3.12.1-py3-none-any.whl (913 kB)
Collecting djongo==1.3.3
Downloading djongo-1.3.3.tar.gz (334 kB)
Collecting Pillow==8.0.0
Downloading Pillow-8.0.0.tar.gz (44.6 MB)
Collecting pylint==2.6.0
Downloading pylint-2.6.0-py3-none-any.whl (325 kB)
Collecting requests==2.24.0
Downloading requests-2.24.0-py2.py3-none-any.whl (61 kB)
Collecting sqlparse==0.2.4
Downloading sqlparse-0.2.4-py2.py3-none-any.whl (38 kB)
Collecting urllib3==1.25.11
Downloading urllib3-1.25.11-py2.py3-none-any.whl (127 kB)
Collecting pytz
Downloading pytz-2020.4-py2.py3-none-any.whl (509 kB)
Collecting pymongo>=3.2.0
Downloading pymongo-3.11.0.tar.gz (771 kB)
Collecting astroid<=2.5,>=2.4.0
Downloading astroid-2.4.2-py3-none-any.whl (213 kB)
Collecting toml>=0.7.1
Downloading toml-0.10.2-py2.py3-none-any.whl (16 kB)
Collecting mccabe<0.7,>=0.6
Downloading mccabe-0.6.1-py2.py3-none-any.whl (8.6 kB)
Collecting isort<6,>=4.2.5
Downloading isort-5.6.4-py3-none-any.whl (98 kB)
Collecting idna<3,>=2.5
Downloading idna-2.10-py2.py3-none-any.whl (58 kB)
Collecting chardet<4,>=3.0.2
Downloading chardet-3.0.4-py2.py3-none-any.whl (133 kB)
Collecting certifi>=2017.4.17
Downloading certifi-2020.11.8-py2.py3-none-any.whl (155 kB)
Collecting wrapt~=1.11
Downloading wrapt-1.12.1.tar.gz (27 kB)
I don't know why this happen again and again. I thought something cache in my docker system. I already tried remove all the docker images, docker cache deleted... etc...
How can I fix it?
FROM python:3.8-alpine
ENV PATH="/scripts:${PATH}"
ENV LIBRARY_PATH=/lib:/usr/lib
COPY ./requirements.txt /requirements.txt
RUN apk add --update --no-cache --virtual .tmp gcc libc-dev linux-headers jpeg-dev libjpeg-turbo
RUN apk add build-base python3-dev zlib-dev
RUN pip install --upgrade pip
RUN pip install --no-cache-dir -r /requirements.txt
RUN apk add libjpeg
RUN apk del .tmp
RUN mkdir /webserver
COPY ./webserver /webserver
WORKDIR /webserver
COPY ./scripts /scripts
RUN chmod +x /scripts/*
RUN mkdir -p /vol/web/media
RUN mkdir -p /vol/web/
RUN adduser -D user
RUN chown -R user:user /vol
RUN chmod -R 755 /vol/web
USER user
CMD ["entrypoint.sh"]
This is my docker file. pip install --no-cache-dir doesn't work either...