File size: 1,041 Bytes
fe115ca
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3524dd5
9749881
 
40a49ec
3524dd5
03e41cf
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
# 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"]