ISGDModelDemo / Dockerfile
KagChi's picture
feat: use preloaded model
9749881 verified
Raw History Blame Contribute Delete
1.04 kB
# Use official Python 3.12 base image
FROM python:3.12
# Create a non-root user and switch to it
RUN useradd -m -u 1000 user
USER user
# Set working directory
WORKDIR /app
# Add Poetry to PATH
ENV PATH="/home/user/.local/bin:$PATH"
# Install Poetry for the current user
RUN pip install --user poetry
# Copy pyproject and poetry.lock to install dependencies
COPY --chown=user pyproject.toml poetry.lock ./
# Disable Poetry's virtual environment creation
RUN poetry config virtualenvs.create false --local
# Install dependencies (but not the current project itself)
RUN poetry install --no-root --no-interaction --no-cache
# Copy the rest of the application code
COPY --chown=user . .
# Expose port
EXPOSE 7860
# Download the model files (now that /models is writable)
# RUN mkdir -p /app/models && curl https://s3.tebi.io/models/model.pkl -o /app/models/model.pkl && \
# curl https://s3.tebi.io/models/tokenizer.pkl -o /app/models/tokenizer.pkl
# Run your app
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]