Spaces:
Build error
Build error
# docker build -t news-extractor:0.1.0 -f ./Dockerfile-cpu . | |
# docker run --rm -it -v $(pwd)/models:/app/models -p 7860:7860 news-extractor:0.1.0 | |
FROM python:3.9 | |
ENV PYTHON_VERSION=3.9 | |
ENV POETRY_VERSION=1.3.1 | |
ENV POETRY_VENV=/opt/poetry-venv | |
RUN export DEBIAN_FRONTEND=noninteractive \ | |
&& apt-get -qq update \ | |
&& apt-get -qq install --no-install-recommends \ | |
python${PYTHON_VERSION} \ | |
python${PYTHON_VERSION}-venv \ | |
python3-pip \ | |
&& rm -rf /var/lib/apt/lists/* | |
RUN ln -s -f /usr/bin/python${PYTHON_VERSION} /usr/bin/python3 && \ | |
ln -s -f /usr/bin/python${PYTHON_VERSION} /usr/bin/python && \ | |
ln -s -f /usr/bin/pip3 /usr/bin/pip | |
RUN python3 -m venv $POETRY_VENV \ | |
&& $POETRY_VENV/bin/pip install -U pip setuptools \ | |
&& $POETRY_VENV/bin/pip install poetry==${POETRY_VERSION} | |
ENV PATH="${PATH}:${POETRY_VENV}/bin" | |
RUN mkdir -p /.cache/pypoetry/virtualenvs | |
RUN chmod -R 777 /.cache | |
RUN useradd -m -u 1000 user | |
USER user | |
ENV HOME=/home/user \ | |
PATH=/home/user/.local/bin:$PATH | |
WORKDIR $HOME/app | |
COPY ./src $HOME/app/src | |
COPY ./src $HOME/app | |
COPY ./model $HOME/app/model | |
COPY ./pyproject.toml $HOME/app | |
COPY ./README.md $HOME/app | |
RUN poetry lock --no-update | |
RUN poetry install --no-root | |
CMD [ "poetry", "run", "app"] |