File size: 1,175 Bytes
afd2cc6 eb52047 6a6828e afd2cc6 6a6828e afd2cc6 4d48d5a 6a6828e afd2cc6 4d48d5a 6a6828e 4d48d5a afd2cc6 6a6828e afd2cc6 4d48d5a 6a6828e afd2cc6 6a6828e 4d48d5a 6a6828e 4d48d5a 6a6828e fb3dfc3 6a6828e 4d48d5a 6a6828e 4d48d5a 6a6828e 4d48d5a 6a6828e |
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 46 47 48 |
FROM python:3.10-slim
LABEL maintainer="Universal Translator Team"
LABEL description="Universal Translator API with CTranslate2 optimization"
# Set environment variables
ENV PYTHONDONTWRITEBYTECODE=1 \
PYTHONUNBUFFERED=1 \
CT2_MODEL_CACHE=/app/.cache/ct2_models \
NLTK_DATA=/app/nltk_data
# Install system dependencies
RUN apt-get update && apt-get install -y --no-install-recommends \
build-essential \
cmake \
git \
wget \
curl \
unzip \
pkg-config \
libpoppler-cpp-dev \
poppler-utils \
libgl1-mesa-glx \
&& rm -rf /var/lib/apt/lists/*
# Create directories
WORKDIR /app
RUN mkdir -p /app/app/models /app/.cache/ct2_models /app/nltk_data
# Copy requirements first for better caching
COPY requirements.txt .
# Install dependencies
RUN pip install --upgrade pip && \
pip install -r requirements.txt
# Copy application files
COPY . .
# Set permissions
RUN chmod -R 777 /app/.cache/ct2_models && \
python -c "import nltk; nltk.download('punkt', download_dir='/app/nltk_data')"
# Expose the port
EXPOSE 7860
# Start the application
CMD ["uvicorn", "api_server:app", "--host", "0.0.0.0", "--port", "7860"] |