Removing using python wheels to build python dependecies due to issue resolving conflicts in package sub-dependencies. Ends up being much more trouble than it's worth.

This commit is contained in:
Arnav Choudhury 2020-09-12 11:04:08 +05:30
parent 07051bff33
commit a795086b10
2 changed files with 12 additions and 14 deletions

View File

@ -15,8 +15,8 @@ RUN apt-get update && apt-get install --no-install-recommends -y \
# cleaning up unused files
&& apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false \
&& rm -rf /var/lib/apt/lists/* \
# create python dependency wheels
&& pip wheel --no-cache-dir --no-deps --use-feature=2020-resolver --wheel-dir /usr/src/app/wheels -r /requirements/local.txt \
# install python dependencies
&& pip install --no-cache-dir --use-feature=2020-resolver -r /requirements/local.txt \
&& rm -rf /requirements
@ -61,11 +61,10 @@ RUN apt-get update && apt-get install --no-install-recommends -y \
&& rm -rf /var/lib/apt/lists/*
# copy python dependency wheels from python-build-stage
COPY --from=python-build-stage /usr/src/app/wheels /wheels
# install python dependencies
RUN pip install --no-cache /wheels/*
# copy python dependencies from python-build-stage
COPY --from=build_stage /usr/local/lib/python3.8/site-packages/ /usr/local/lib/python3.8/site-packages/
COPY --from=build_stage /usr/local/bin/ /usr/local/bin/

View File

@ -11,7 +11,7 @@ RUN npm run build
# Python build stage
FROM python:3.8-slim-buster as python-build-stage
ENV PYTHONDONTWRITEBYTECODE 1
# Requirements are installed here to ensure they will be cached.
COPY ./requirements /requirements
@ -26,14 +26,15 @@ RUN apt-get update && apt-get install --no-install-recommends -y \
# cleaning up unused files
&& apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false \
&& rm -rf /var/lib/apt/lists/* \
# create python dependency wheels
&& pip wheel --no-cache-dir --no-deps --use-feature=2020-resolver --wheel-dir /usr/src/app/wheels -r /requirements/production.txt \
# install python dependencies
&& pip install --no-cache-dir --use-feature=2020-resolver -r /requirements/production.txt \
&& rm -rf /requirements
# Python 'run' stage
FROM python:3.8-slim-buster
ENV PYTHONDONTWRITEBYTECODE 1
ENV PYTHONUNBUFFERED 1
RUN addgroup --system django \
@ -76,11 +77,9 @@ RUN apt-get update && apt-get install --no-install-recommends -y \
&& rm -rf /var/lib/apt/lists/*
# copy python dependency wheels from python-build-stage
COPY --from=python-build-stage /usr/src/app/wheels /wheels
# install python dependencies
RUN pip install --no-cache /wheels/*
# copy python dependencies from python-build-stage
COPY --from=build_stage /usr/local/lib/python3.8/site-packages/ /usr/local/lib/python3.8/site-packages/
COPY --from=build_stage /usr/local/bin/ /usr/local/bin/
{%- if cookiecutter.js_task_runner == 'Gulp' %}
COPY --from=client-builder --chown=django:django /app /app