news-extractor / Dockerfile-gpu
Ümit Gündüz
add dataset and update code documentation
f4f5cfb
# docker build -t news-extractor:0.1.0 -f ./Dockerfile-gpu .
# docker run --rm -it -v $(pwd)/models:/app/models -p 7860:7860 news-extractor:0.1.0
# docker run --rm -it -v $(pwd)/models:/app/models -v $(pwd)/data:/app/data -p 7860:7860 news-extractor:0.1.0
FROM nvidia/cuda:11.2.0-base-ubuntu20.04
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"
WORKDIR /app
COPY ./src /app/src
COPY ./src /app/
COPY ./model /app/model
COPY ./pyproject.toml /app
COPY ./README.md /app
COPY ./data/dataset /app/data/dataset
RUN poetry lock --no-update
RUN poetry install --no-root
CMD [ "poetry", "run", "app"]