我需要PCRE支持我的uwsgi运行。因此,我计划将libpcre3
和libpcre3-dev
添加到我的docker中。
FROM python:3.9-alpine3.13
ENV PYTHONUNBUFFERED 1
COPY ./requirements.txt /tmp/requirements.txt
COPY ./requirements.dev.txt /tmp/requirements.dev.txt
COPY ./scripts /scripts
COPY ./app /app
WORKDIR /app
EXPOSE 8000
ARG DEV=false
RUN python -m venv /py &&
/py/bin/pip install --upgrade pip &&
apk add --update --no-cache postgresql-client jpeg-dev libpcre3-dev libpcre3 &&
apk add --update --no-cache --virtual .tmp-build-deps
build-base postgresql-dev musl-dev zlib zlib-dev linux-headers &&
/py/bin/pip install -r /tmp/requirements.txt &&
if [ $DEV = "true" ]; then /py/bin/pip install -r /tmp/requirements.dev.txt ;
fi &&
rm -rf /tmp &&
apk del .tmp-build-deps &&
adduser
--disabled-password
--no-create-home
django-user &&
mkdir -p /vol/web/media &&
mkdir -p /vol/web/static &&
chown -R django-user:django-user /vol &&
chmod -R 755 /vol &&
chmod -R +x /scripts
ENV PATH="/scripts:/py/bin:$PATH"
我得到的错误是:
> [recipe-app-api-app 7/7] RUN python -m venv /py && /py/bin/pip install --upgrade pip && apk add --update --no-cache postgresql-client jpeg-dev libpcre3-dev libpcre3 && apk add --update --no-cache --virtual .tmp-build-deps build-base postgresql-dev musl-dev zlib zlib-dev linux-headers && /py/bin/pip install -r /tmp/requirements.txt && if [ false = "true" ]; then /py/bin/pip install -r /tmp/requirements.dev.txt ; fi && rm -rf /tmp && apk del .tmp-build-deps && adduser --disabled-password --no-create-home django-user && mkdir -p /vol/web/media && mkdir -p /vol/web/static && chown -R django-user:django-user /vol && chmod -R 755 /vol && chmod -R +x /scripts:
#0 4.542 Requirement already satisfied: pip in /py/lib/python3.9/site-packages (21.2.4)
#0 4.820 Collecting pip
#0 4.970 Downloading pip-22.3.1-py3-none-any.whl (2.1 MB)
#0 5.584 Installing collected packages: pip
#0 5.584 Attempting uninstall: pip
#0 5.584 Found existing installation: pip 21.2.4
#0 5.680 Uninstalling pip-21.2.4:
#0 5.688 Successfully uninstalled pip-21.2.4
#0 7.017 Successfully installed pip-22.3.1
#0 7.268 fetch https://dl-cdn.alpinelinux.org/alpine/v3.13/main/x86_64/APKINDEX.tar.gz
#0 7.753 fetch https://dl-cdn.alpinelinux.org/alpine/v3.13/community/x86_64/APKINDEX.tar.gz
#0 8.331 ERROR: unable to select packages:
#0 8.356 libpcre3 (no such package):
#0 8.356 required by: world[libpcre3]
#0 8.356 libpcre3-dev (no such package):
#0 8.356 required by: world[libpcre3-dev]
------
failed to solve: executor failed running [/bin/sh -c python -m venv /py && /py/bin/pip install --upgrade pip && apk add --update --no-cache postgresql-client jpeg-dev libpcre3-dev libpcre3 && apk add --update --no-cache --virtual .tmp-build-deps build-base postgresql-dev musl-dev zlib zlib-dev linux-headers && /py/bin/pip install -r /tmp/requirements.txt && if [ $DEV = "true" ]; then /py/bin/pip install -r /tmp/requirements.dev.txt ; fi && rm -rf /tmp && apk del .tmp-build-deps && adduser --disabled-password --no-create-home django-user && mkdir -p /vol/web/media && mkdir -p /vol/web/static && chown -R django-user:django-user /vol && chmod -R 755 /vol && chmod -R +x /scripts]: exit code: 2
所以我可以做些什么来添加下面的包吗?
我已经尝试用不同的名字安装,并在网上搜索了很多,但仍然没有一个想法添加这些包。
最后我可以通过安装β.εηοιτ提到的pcre-dev
包来运行我的uwsgi。βε on无法在Alpine上安装uwsgi
FROM python:3.9-alpine3.13
ENV PYTHONUNBUFFERED 1
COPY ./requirements.txt /tmp/requirements.txt
COPY ./requirements.dev.txt /tmp/requirements.dev.txt
COPY ./scripts /scripts
COPY ./app /app
WORKDIR /app
EXPOSE 8000
ARG DEV=false
RUN python -m venv /py &&
/py/bin/pip install --upgrade pip &&
apk add --update --no-cache postgresql-client jpeg-dev pcre-dev &&
apk add --update --no-cache --virtual .tmp-build-deps
build-base postgresql-dev musl-dev zlib zlib-dev linux-headers &&
/py/bin/pip install -r /tmp/requirements.txt &&
if [ $DEV = "true" ]; then /py/bin/pip install -r /tmp/requirements.dev.txt ;
fi &&
rm -rf /tmp &&
apk del .tmp-build-deps &&
adduser
--disabled-password
--no-create-home
django-user &&
mkdir -p /vol/web/media &&
mkdir -p /vol/web/static &&
chown -R django-user:django-user /vol &&
chown -R django-user:django-user ./* &&
chmod -R 755 /vol &&
chmod -R +x /scripts
ENV PATH="/scripts:/py/bin:$PATH"
USER django-user