Код: Выделить всё
ARG PY_VER=3.12
ARG BUILD=default
# Build stage
FROM python:${PY_VER}-slim AS base_default
RUN pip install --no-cache-dir --upgrade gunicorn
# Deploy stage
FROM python:${PY_VER}-slim AS build_default
ARG PY_VER
ARG BUILD
COPY --from=base_${BUILD} /usr/local/bin/gunicorn /usr/local/bin/gunicorn
COPY --from=base_${BUILD} /usr/local/lib/python${PY_VER}/site-packages/ /usr/local/lib/python${PY_VER}/site-packages/
CMD ["gunicorn", "-h"]
Код: Выделить всё
Test:16
--------------------
14 | COPY --from=base_${BUILD} /usr/local/bin/gunicorn /usr/local/bin/gunicorn
15 |
16 | >>> COPY --from=base_${BUILD} /usr/local/lib/python${PY_VER}/site-packages/ /usr/local/lib/python${PY_VER}/site-packages/
17 |
18 | CMD ["gunicorn", "-h"]
--------------------
ERROR: failed to solve: failed to parse stage name "base_${BUILD}": invalid reference format: repository name (library/base_${BUILD}) must be lowercase
Подробнее здесь: https://stackoverflow.com/questions/792 ... -build-arg
Мобильная версия