adgenesis / Dockerfile
userIdc2024's picture
Update Dockerfile
e026355 verified
raw
history blame contribute delete
974 Bytes
# Use minimal Python base image
FROM python:3.11-slim
WORKDIR /code
# Install system dependencies
RUN apt update && apt install -y --no-install-recommends \
libssl-dev \
libffi-dev \
&& rm -rf /var/lib/apt/lists/*
# Copy only requirements first
COPY ./requirements.txt /code/requirements.txt
# Install all dependencies from `requirements.txt`
RUN pip install --no-cache-dir --prefer-binary -r /code/requirements.txt
# Install `accelerate` separately WITHOUT dependencies (prevents `torch` installation)
RUN pip install --no-cache-dir --no-deps accelerate==0.26.0
RUN pip install --no-cache-dir --no-deps sentence_transformers==3.3.0
RUN pip install --no-cache-dir torch --index-url https://download.pytorch.org/whl/cpu
# Copy application code
COPY ./app /code/app
COPY ./startup.sh /code/startup.sh
# Set script permissions
RUN chmod +x /code/startup.sh
# Use a non-root user
RUN useradd -m appuser
USER appuser
EXPOSE 80
CMD ["sh", "/code/startup.sh"]