-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathDockerfile
More file actions
47 lines (37 loc) · 1.12 KB
/
Copy pathDockerfile
File metadata and controls
47 lines (37 loc) · 1.12 KB
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
FROM nvidia/cuda:11.8.0-runtime-ubuntu22.04
# Install system deps
RUN apt-get update && \
apt-get install -y python3.10 python3-pip build-essential git graphviz && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
# Set working directory
WORKDIR /app
# Copy requirements first for better caching
COPY requirements.txt .
# Install base requirements
RUN pip3 install --no-cache-dir -r requirements.txt
# Install specific versions for compatibility
# Using PyTorch 2.0.1 instead of 2.6+ to avoid unpickling issues with older checkpoints
RUN pip3 install --no-cache-dir \
torch==2.0.1 \
torchvision==0.15.2 \
torchaudio==2.0.2 \
--extra-index-url https://download.pytorch.org/whl/cu118 \
pyarrow==14.0.1 \
transformers==4.36.2 \
streamlit==1.29.0 \
pandas==2.0.3 \
datasets==2.14.6
# Copy application code
COPY . .
# Security fix: run as non-root user
RUN useradd -m -s /bin/bash appuser && \
chown -R appuser:appuser /app
USER appuser
# Set up environment
ENV PYTHONPATH=/app
ENV PYTHONUNBUFFERED=1
# Expose port for Streamlit
EXPOSE 8501
# Run Streamlit
CMD ["streamlit", "run", "app.py"]