-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathDockerfile.lithops.cpu
More file actions
83 lines (67 loc) · 2.1 KB
/
Dockerfile.lithops.cpu
File metadata and controls
83 lines (67 loc) · 2.1 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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
# Dockerfile for CoSMo PSS Lithops Runtime (CPU-ONLY)
# Optimized for AWS Lambda, Azure Functions, Google Cloud Functions
# This is the recommended option for serverless FaaS platforms
FROM python:3.10-slim
LABEL maintainer="CoSMo PSS Team"
LABEL description="CoSMo PSS Lithops Runtime - CPU-only for serverless execution"
LABEL runtime_type="cpu"
# Install system dependencies
RUN apt-get update && apt-get install -y --no-install-recommends \
git \
wget \
curl \
build-essential \
libgomp1 \
libglib2.0-0 \
libsm6 \
libxext6 \
libxrender-dev \
libgl1-mesa-glx \
&& rm -rf /var/lib/apt/lists/*
# Set working directory
WORKDIR /function
# Upgrade pip
RUN pip install --no-cache-dir --upgrade pip setuptools wheel
# Install PyTorch CPU-only (significantly smaller than GPU version)
RUN pip install --no-cache-dir \
torch==2.1.0 \
torchvision==0.16.0 \
torchaudio==2.1.0 \
--index-url https://download.pytorch.org/whl/cpu
# Install core ML dependencies
RUN pip install --no-cache-dir \
transformers==4.35.2 \
sentence-transformers==2.2.2 \
huggingface-hub==0.19.4 \
accelerate==0.25.0 \
safetensors==0.4.1 \
tokenizers==0.15.0
# Install image processing libraries
RUN pip install --no-cache-dir \
Pillow==10.1.0 \
opencv-python-headless==4.8.1.78
# Install scientific computing packages
RUN pip install --no-cache-dir \
numpy==1.24.3 \
pandas==2.1.3 \
scipy==1.11.4
# Install Lithops
RUN pip install --no-cache-dir lithops==3.3.1
# Install additional utilities
RUN pip install --no-cache-dir \
tqdm==4.66.1 \
pyyaml==6.0.1
# Copy CoSMo PSS code
COPY src/cosmo /function/cosmo
# Set Python path
ENV PYTHONPATH=/function:$PYTHONPATH
# Environment variables for model caching
ENV TRANSFORMERS_CACHE=/tmp/transformers_cache
ENV HF_HOME=/tmp/hf_home
ENV TORCH_HOME=/tmp/torch_home
ENV HF_DATASETS_OFFLINE=1
ENV TRANSFORMERS_OFFLINE=0
# Create cache directories
RUN mkdir -p /tmp/transformers_cache /tmp/hf_home /tmp/torch_home
# Set entrypoint for Lithops
CMD ["python", "-c", "print('CoSMo PSS Lithops CPU Runtime Ready')"]