Skip to content

Commit

Permalink
Optional container build instructions (opea-project#457)
Browse files Browse the repository at this point in the history
Signed-off-by: chensuyue <[email protected]>
  • Loading branch information
chensuyue authored and BaoHuiling committed Aug 15, 2024
1 parent 395c8b3 commit c2ce13a
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 5 deletions.
8 changes: 6 additions & 2 deletions comps/agent/langchain/docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
FROM python:3.11-slim

ENV LANG=C.UTF-8
ARG ARCH=cpu

RUN apt-get update -y && apt-get install -y --no-install-recommends --fix-missing \
build-essential \
Expand All @@ -19,8 +20,11 @@ USER user
COPY comps /home/user/comps

RUN pip install --no-cache-dir --upgrade pip setuptools && \
if [ ${ARCH} = "cpu" ]; then pip install torch --index-url https://download.pytorch.org/whl/cpu; fi && \
pip install --no-cache-dir -r /home/user/comps/agent/langchain/requirements.txt
if [ ${ARCH} = "cpu" ]; then \
pip install --no-cache-dir --extra-index-url https://download.pytorch.org/whl/cpu -r /home/user/comps/agent/langchain/requirements.txt; \
else \
pip install --no-cache-dir -r /home/user/comps/agent/langchain/requirements.txt; \
fi

ENV PYTHONPATH=$PYTHONPATH:/home/user

Expand Down
7 changes: 6 additions & 1 deletion comps/asr/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,16 @@ RUN useradd -m -s /bin/bash user && \
USER user

ENV LANG=C.UTF-8
ARG ARCH=cpu

COPY comps /home/user/comps

RUN pip install --no-cache-dir --upgrade pip && \
pip install --no-cache-dir -r /home/user/comps/asr/requirements.txt
if [ "${ARCH}" = "cpu" ]; then \
pip install --no-cache-dir --extra-index-url https://download.pytorch.org/whl/cpu -r /home/user/comps/asr/requirements.txt ; \
else \
pip install --no-cache-dir -r /home/user/comps/asr/requirements.txt ; \
fi

ENV PYTHONPATH=$PYTHONPATH:/home/user

Expand Down
6 changes: 6 additions & 0 deletions comps/asr/whisper/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ RUN useradd -m -s /bin/bash user && \

# Set environment variables
ENV LANG=en_US.UTF-8
ARG ARCH=cpu

# Install system dependencies
RUN apt-get update \
Expand All @@ -21,6 +22,11 @@ USER user

RUN pip install --no-cache-dir --upgrade pip && \
pip install --no-cache-dir -r /home/user/comps/asr/requirements.txt && \
if [ "${ARCH}" = "cpu" ]; then \
pip install --no-cache-dir --extra-index-url https://download.pytorch.org/whl/cpu -r /home/user/comps/asr/requirements.txt ; \
else \
pip install --no-cache-dir -r /home/user/comps/asr/requirements.txt ; \
fi
pip list

ENV PYTHONPATH=$PYTHONPATH:/home/user
Expand Down
7 changes: 6 additions & 1 deletion comps/tts/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,16 @@ RUN useradd -m -s /bin/bash user && \
chown -R user /home/user/
USER user
ENV LANG=C.UTF-8
ARG ARCH=cpu

COPY comps /home/user/comps

RUN pip install --no-cache-dir --upgrade pip && \
pip install --no-cache-dir -r /home/user/comps/tts/requirements.txt
if [ "${ARCH}" = "cpu" ]; then \
pip install --no-cache-dir --extra-index-url https://download.pytorch.org/whl/cpu -r /home/user/comps/tts/requirements.txt ; \
else \
pip install --no-cache-dir -r /home/user/comps/tts/requirements.txt ; \
fi

ENV PYTHONPATH=$PYTHONPATH:/home/user

Expand Down
7 changes: 6 additions & 1 deletion comps/tts/speecht5/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ RUN useradd -m -s /bin/bash user && \
# Set environment variables
ENV LANG=en_US.UTF-8
ENV PYTHONPATH=/home/user
ARG ARCH=cpu

# Install system dependencies
RUN apt-get update \
Expand All @@ -20,7 +21,11 @@ COPY --chown=user:user comps /home/user/comps
USER user

RUN pip install --no-cache-dir --upgrade pip && \
pip install --no-cache-dir -r /home/user/comps/tts/requirements.txt
if [ "${ARCH}" = "cpu" ]; then \
pip install --no-cache-dir --extra-index-url https://download.pytorch.org/whl/cpu -r /home/user/comps/tts/requirements.txt ; \
else \
pip install --no-cache-dir -r /home/user/comps/tts/requirements.txt ; \
fi

ENV PYTHONPATH=$PYTHONPATH:/home/user

Expand Down

0 comments on commit c2ce13a

Please sign in to comment.