File size: 1,078 Bytes
74b1bac |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
# Use Python 3.10-slim image
FROM python:3.11-slim-bookworm AS base
# Use args
ARG USE_CUDA
ARG USE_CUDA_VER
## Basis ##
ENV ENV=prod \
PORT=9099 \
# pass build args to the build
USE_CUDA_DOCKER=${USE_CUDA} \
USE_CUDA_DOCKER_VER=${USE_CUDA_VER}
# Install GCC and build tools
RUN apt-get update && \
apt-get install -y gcc build-essential curl git pkg-config libicu-dev && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
WORKDIR /app
COPY ./bm25s ./bm25s
RUN pip3 install ./bm25s
COPY ./requirements.txt .
RUN pip3 install uv && \
if [ "$USE_CUDA" = "true" ]; then \
pip3 install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/$USE_CUDA_DOCKER_VER --no-cache-dir; \
else \
pip3 install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cpu --no-cache-dir; \
fi
RUN uv pip install --system -r requirements.txt --no-cache-dir
# Copy the application code
COPY . .
# Expose the port
ENV HOST="0.0.0.0"
ENV PORT="9099"
# Set entrypoint
ENTRYPOINT [ "bash", "start.sh" ]
|