-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile.test
More file actions
42 lines (33 loc) · 1.2 KB
/
Dockerfile.test
File metadata and controls
42 lines (33 loc) · 1.2 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
# Test Dockerfile for simulating GPU code on CPU
FROM python:3.10-slim
# Install Python dependencies
RUN apt-get update && apt-get install -y \
build-essential \
git \
libglib2.0-0 \
libsm6 \
libxrender1 \
libxext6 \
ffmpeg \
&& rm -rf /var/lib/apt/lists/*
# Set working directory
WORKDIR /app
# Set environment variables to force CPU mode
ENV PYTHONUNBUFFERED=1
ENV PYTHONPATH=/app
ENV CUDA_VISIBLE_DEVICES=""
ENV FORCE_CUDA=0
ENV TRANSFORMERS_CACHE=/cache/huggingface
# Copy requirements.txt before installing dependencies
COPY requirements.txt requirements.txt
# Install CPU version of PyTorch and dependencies
RUN pip3 install --no-cache-dir --upgrade pip && \
pip3 install --no-cache-dir torch==2.1.2+cpu torchvision==0.16.2+cpu torchaudio==2.1.2+cpu -f https://download.pytorch.org/whl/torch_stable.html \
&& pip3 install --no-cache-dir -r requirements.txt
# Copy the rest of the project
COPY . .
# Replace host config with Docker-specific defaults (test image)
COPY src/book_to_essay/config.docker.py /app/src/book_to_essay/config.py
# Expose Streamlit port
EXPOSE 8501
CMD ["streamlit", "run", "src/book_to_essay/streamlit_app.py"]